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
Merge remote-tracking branch 'up/v0.26-facets' into v0.26-facets
Harpreet Sangar1b14bc2e06d8
diff --cc src/index.cppindex 8014bc9c,dd42727c..762afec8--- a/src/index.cpp+++ b/src/index.cpp@@@ -2745,12 -2689,8 +2745,12 @@@ Option<bool> Index::search(std::vector<for(size_t res_index = 0; res_index < vec_results.size(); res_index++) {auto& vec_result = vec_results[res_index];- auto doc_id = vec_result.first;+ auto seq_id = vec_result.first;+- filter_result_iterator->skip_to(doc_id);++ filter_result_iterator->skip_to(seq_id);+ auto references = std::move(filter_result_iterator->reference);+ filter_result_iterator->reset();- auto result_it = topster->kv_map.find(doc_id);+ auto result_it = topster->kv_map.find(seq_id);if(result_it != topster->kv_map.end()) {if(result_it->second->match_score_index < 0 || result_it->second->match_score_index > 2) {@@@ -2768,39 -2708,46 +2768,49 @@@((1.0 / (res_index + 1)) * VECTOR_SEARCH_WEIGHT));int64_t match_score_index = -1;int64_t scores[3] = {0};-- compute_sort_scores(sort_fields_std, sort_order, field_values, geopoint_indices, seq_id, 0,- match_score, scores, match_score_index, vec_result.second);++ auto compute_sort_scores_op = compute_sort_scores(sort_fields_std, sort_order, field_values,- geopoint_indices, doc_id, references, 0,++ geopoint_indices, seq_id, references, 0,+ match_score, scores, match_score_index,+ vec_result.second, collection_name);+ if (!compute_sort_scores_op.ok()) {+ return compute_sort_scores_op;+ }for(int i = 0; i < 3; i++) {- result->scores[i] = scores[i];+ kv->scores[i] = scores[i];}- result->match_score_index = match_score_index;++ kv->match_score_index = match_score_index;+} else {// Result has been found only in vector search: we have to add it to both KV and result_ids// (1 / rank_of_document) * WEIGHT)int64_t scores[3] = {0};int64_t match_score = float_to_int64_t((1.0 / (res_index + 1)) * VECTOR_SEARCH_WEIGHT);int64_t match_score_index = -1;- compute_sort_scores(sort_fields_std, sort_order, field_values, geopoint_indices, seq_id, 0, match_score, scores, match_score_index, vec_result.second);++ auto compute_sort_scores_op = compute_sort_scores(sort_fields_std, sort_order, field_values,- geopoint_indices, doc_id, references, 0,++ geopoint_indices, seq_id, references, 0,+ match_score, scores, match_score_index,+ vec_result.second, collection_name);+ if (!compute_sort_scores_op.ok()) {+ return compute_sort_scores_op;+ }- KV kv(searched_queries.size(), doc_id, doc_id, match_score_index, scores, std::move(references));++ uint64_t distinct_id = seq_id;+ if (group_limit != 0) {+ distinct_id = get_distinct_id(group_by_fields, seq_id);+ if(excluded_group_ids.count(distinct_id) != 0) {+ continue;+ }+ }-- KV kv(searched_queries.size(), seq_id, distinct_id, match_score_index, scores);++ KV kv(searched_queries.size(), seq_id, distinct_id, match_score_index, scores, std::move(references));kv.text_match_score = 0;kv.vector_distance = vec_result.second;- if (filter_result_iterator->is_valid &&- !filter_result_iterator->reference.empty()) {- // The doc_id must be valid otherwise it would've been filtered out upstream.- filter_result_iterator->skip_to(doc_id);- kv.reference_filter_results = std::move(filter_result_iterator->reference);- filter_result_iterator->reset();- }-topster->add(&kv);- vec_search_ids.push_back(doc_id);+ vec_search_ids.push_back(seq_id);}}