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
C++ algoliadatastoreelasticsearchenterprise-searchfacetingfull-text-searchfuzzy-searchgeosearchin-memoryinstantsearchmerchandisingpineconesearchsearch-enginesemantic-searchsimilarity-searchsite-searchsynonymstypo-tolerancevector-search
Do not flatten topster if not grouping
ozanarmagan2d0b976f03f5
diff --git a/src/index.cpp b/src/index.cppindex ba57844c..d545a927 100644--- a/src/index.cpp+++ b/src/index.cpp@@ -3194,18 +3194,19 @@ Option<bool> Index::search(std::vector<query_tokens_t>& field_query_tokens, conskvs.push_back(kv_map.second->getKV(i));}}++ std::sort(kvs.begin(), kvs.end(), Topster::is_greater);} else {- for(int i = 0; i < topster->size; i++) {- kvs.push_back(topster->getKV(i));- }+ topster->sort();}- std::sort(kvs.begin(), kvs.end(), Topster::is_greater);+// Reciprocal rank fusion// Score is sum of (1 / rank_of_document) * WEIGHT from each list (text match and vector search)- for(uint32_t i = 0; i < kvs.size(); i++) {- auto result = kvs[i];+ auto size = (group_limit != 0) ? kvs.size() : topster->size;+ for(uint32_t i = 0; i < size; i++) {+ auto result = (group_limit != 0) ? kvs[i] : topster->getKV(i);if(result->match_score_index < 0 || result->match_score_index > 2) {continue;}