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
Fix regression in `out_of` in exclude_fields.
Kishore Nallanaf28e9d239fd
diff --git a/src/collection.cpp b/src/collection.cppindex 52e9d421..cf99523b 100644--- a/src/collection.cpp+++ b/src/collection.cpp@@ -993,6 +993,11 @@ Option<nlohmann::json> Collection::search(const std::string & raw_query,}for(auto& f_name: exclude_fields) {+ if(f_name == "out_of") {+ // `out_of` is strictly a meta-field, but we handle it since it's useful+ continue;+ }+auto field_op = extract_field_name(f_name, search_schema, exclude_fields_vec, false, enable_nested_fields);if(!field_op.ok()) {return Option<nlohmann::json>(404, field_op.error());diff --git a/test/collection_specific_more_test.cpp b/test/collection_specific_more_test.cppindex ba14f33a..8bf2d95a 100644--- a/test/collection_specific_more_test.cpp+++ b/test/collection_specific_more_test.cpp@@ -1434,3 +1434,27 @@ TEST_F(CollectionSpecificMoreTest, VerifyDeletionOfFacetStringIndex) {ASSERT_EQ(0, kv.second->size);}}++TEST_F(CollectionSpecificMoreTest, MustExcludeOutOf) {+ nlohmann::json schema = R"({+ "name": "coll1",+ "fields": [+ {"name": "title", "type": "string"}+ ]+ })"_json;++ Collection* coll1 = collectionManager.create_collection(schema).get();++ nlohmann::json doc;+ doc["title"] = "Sample Title 1";+ ASSERT_TRUE(coll1->add(doc.dump()).ok());++ spp::sparse_hash_set<std::string> include_fields;+ auto res_op = coll1->search("*", {}, "", {}, {}, {2}, 10, 1,+ FREQUENCY, {true}, 0, include_fields, {"out_of"});++ ASSERT_TRUE(res_op.ok());+ auto res = res_op.get();+ ASSERT_EQ(1, res["hits"].size());+ ASSERT_EQ(0, res.count("out_of"));+}\ No newline at end of file