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
Allow zero number in float values during vector query by id.
Kishore Nallan4a4e50b3c781
diff --git a/src/vector_query_ops.cpp b/src/vector_query_ops.cppindex dfa1dda4..0a5a865f 100644--- a/src/vector_query_ops.cpp+++ b/src/vector_query_ops.cpp@@ -135,7 +135,7 @@ Option<bool> VectorQueryOps::parse_vector_query_str(const std::string& vector_qu}for(auto& fvalue: document[vector_query.field_name]) {- if(!fvalue.is_number_float()) {+ if(!fvalue.is_number()) {return Option<bool>(400, "Document referenced in vector query does not contain a valid ""vector field.");}diff --git a/test/collection_vector_search_test.cpp b/test/collection_vector_search_test.cppindex e3e90b71..f5999df6 100644--- a/test/collection_vector_search_test.cpp+++ b/test/collection_vector_search_test.cpp@@ -265,6 +265,42 @@ TEST_F(CollectionVectorTest, VectorDistanceConfig) {ASSERT_EQ("ip", coll_summary["fields"][2]["vec_dist"].get<std::string>());}+TEST_F(CollectionVectorTest, VectorQueryByIDWithZeroValuedFloat) {+ nlohmann::json schema = R"({+ "name": "coll1",+ "fields": [+ {"name": "title", "type": "string"},+ {"name": "points", "type": "int32"},+ {"name": "vec", "type": "float[]", "num_dim": 3}+ ]+ })"_json;++ Collection* coll1 = collectionManager.create_collection(schema).get();++ auto coll_summary = coll1->get_summary_json();+ ASSERT_EQ("cosine", coll_summary["fields"][2]["vec_dist"].get<std::string>());++ nlohmann::json doc = R"(+ {+ "title": "Title 1",+ "points": 100,+ "vec": [0, 0, 0]+ }+ )"_json;++ ASSERT_TRUE(coll1->add(doc.dump()).ok());++ auto res_op = coll1->search("*", {}, "", {}, {}, {0}, 10, 1, FREQUENCY, {true}, Index::DROP_TOKENS_THRESHOLD,+ spp::sparse_hash_set<std::string>(),+ spp::sparse_hash_set<std::string>(), 10, "", 30, 5,+ "", 10, {}, {}, {}, 0,+ "<mark>", "</mark>", {}, 1000, true, false, true, "", false, 6000 * 1000, 4, 7, fallback,+ 4, {off}, 32767, 32767, 2,+ false, true, "vec:([], id: 0)");++ ASSERT_TRUE(res_op.ok());+}+TEST_F(CollectionVectorTest, VectorUnchangedUpsert) {nlohmann::json schema = R"({"name": "coll1",