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

Add check for vector_distance to be positive

ozanarmagan0050134f1c57
diff --git a/src/collection.cpp b/src/collection.cpp
index 765dbc06..bee1eb99 100644
--- a/src/collection.cpp
+++ b/src/collection.cpp
@@ -1972,7 +1972,7 @@ Option<nlohmann::json> Collection::search(std::string raw_query,
wrapper_doc["geo_distance_meters"] = geo_distances;
}
- if(!vector_query.field_name.empty()) {
+ if(!vector_query.field_name.empty() && field_order_kv->vector_distance > 0) {
wrapper_doc["vector_distance"] = field_order_kv->vector_distance;
}