Skip to content

Open Source alternative to Algolia + Pinecone and an Easier-to-Use alternative to ElasticSearch ⚡ 🔍 ✨ Fast, typo tolerant, in-memory fuzzy Search Engine for building delightful search experiences

Use reference instead of copy.

Kishore Nallan47aca7e66459
diff --git a/TODO.md b/TODO.md
index 2c60a92e..e951d864 100644
--- a/TODO.md
+++ b/TODO.md
@@ -56,7 +56,7 @@
- ~~When prefix=true, use token_ranking_field for token ordering only for last word~~
- ~~only last token should be prefix searched~~
- ~~Prefix-search strings should not be null terminated~~
-- sort results by float field
+- ~~sort results by float field~~
- test for string filter comparison: title < "foo"
- test for token ranking on float field
- test for float int field deletion during doc deletion
diff --git a/src/collection.cpp b/src/collection.cpp
index b5aa7330..ecfcb45e 100644
--- a/src/collection.cpp
+++ b/src/collection.cpp
@@ -1132,10 +1132,10 @@ void Collection::score_results(const std::vector<sort_by> & sort_fields, const i
(MAX_SEARCH_TOKENS - mscore.distance);
const int64_t default_score = 0;
- number_t primary_rank_score = (primary_rank_scores && primary_rank_scores->count(seq_id) > 0) ?
+ const number_t & primary_rank_score = (primary_rank_scores && primary_rank_scores->count(seq_id) > 0) ?
primary_rank_scores->at(seq_id) : default_score;
- number_t secondary_rank_score = (secondary_rank_scores && secondary_rank_scores->count(seq_id) > 0) ?
- secondary_rank_scores->at(seq_id) : default_score;
+ const number_t & secondary_rank_score = (secondary_rank_scores && secondary_rank_scores->count(seq_id) > 0) ?
+ secondary_rank_scores->at(seq_id) : default_score;
const number_t & primary_rank_value = primary_rank_score * primary_rank_factor;
const number_t & secondary_rank_value = secondary_rank_score * secondary_rank_factor;