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

Update hybrid search info

ozanarmagan165371301d99
diff --git a/src/collection.cpp b/src/collection.cpp
index c5d47884..e60ffe41 100644
--- a/src/collection.cpp
+++ b/src/collection.cpp
@@ -1957,17 +1957,13 @@ Option<nlohmann::json> Collection::search(std::string raw_query,
if(field_order_kv->match_score_index == CURATED_RECORD_IDENTIFIER) {
wrapper_doc["curated"] = true;
} else if(field_order_kv->match_score_index >= 0) {
- if(vector_query.field_name.empty()) {
- wrapper_doc["text_match"] = field_order_kv->scores[field_order_kv->match_score_index];
-
- wrapper_doc["text_match_info"] = nlohmann::json::object();
- populate_text_match_info(wrapper_doc["text_match_info"],
- field_order_kv->scores[field_order_kv->match_score_index], match_type);
- } else {
+ wrapper_doc["text_match"] = field_order_kv->scores[field_order_kv->match_score_index];
+ wrapper_doc["text_match_info"] = nlohmann::json::object();
+ populate_text_match_info(wrapper_doc["text_match_info"],
+ field_order_kv->scores[field_order_kv->match_score_index], match_type);
+ if(!vector_query.field_name.empty()) {
wrapper_doc["hybrid_search_info"] = nlohmann::json::object();
wrapper_doc["hybrid_search_info"]["rank_fusion_score"] = Index::int64_t_to_float(field_order_kv->scores[field_order_kv->match_score_index]);
- wrapper_doc["hybrid_search_info"]["text_match_score"] = field_order_kv->text_match_score;
- wrapper_doc["hybrid_search_info"]["vector_distance"] = field_order_kv->vector_distance;
}
}