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 edge case in NOT_EQUALS filtering.
Kishore Nallan9015575ac817
diff --git a/src/index.cpp b/src/index.cppindex 93f157a8..bdf4c875 100644--- a/src/index.cpp+++ b/src/index.cpp@@ -1202,7 +1202,9 @@ uint32_t Index::do_filtering(uint32_t** filter_ids_out, const std::vector<filterquery_suggestion.push_back(leaf);}- if(query_suggestion.size() != str_tokens.size()) {+ // For NOT_EQUALS alone, it is okay for none of the results to match prior to negation+ // e.g. field:- [RANDOM_NON_EXISTING_STRING]+ if(a_filter.comparators[0] != NOT_EQUALS && query_suggestion.size() != str_tokens.size()) {continue;}diff --git a/test/collection_filtering_test.cpp b/test/collection_filtering_test.cppindex f03d4677..0602ae05 100644--- a/test/collection_filtering_test.cpp+++ b/test/collection_filtering_test.cpp@@ -1302,7 +1302,7 @@ TEST_F(CollectionFilteringTest, NegationOperatorBasics) {coll1 = collectionManager.get_collection("coll1").get();if(coll1 == nullptr) {- coll1 = collectionManager.create_collection("coll1", 1, fields, "points").get();+ coll1 = collectionManager.create_collection("coll1", 2, fields, "points").get();}std::vector<std::vector<std::string>> records = {