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
exclude non-indexed field for wildcard pattern (#1660)
Krunal Gandhia23459af4602
diff --git a/src/collection.cpp b/src/collection.cppindex e6e9fe66..cf33d8c7 100644--- a/src/collection.cpp+++ b/src/collection.cpp@@ -1679,7 +1679,7 @@ Option<bool> Collection::extract_field_name(const std::string& field_name,continue;}- if (exact_primitive_match || is_wildcard || text_embedding ||+ if (exact_primitive_match || (is_wildcard && kv->index) || text_embedding ||// field_name prefix must be followed by a "." to indicate an object search(enable_nested_fields && kv.key().size() > field_name.size() && kv.key()[field_name.size()] == '.')) {processed_search_fields.push_back(kv.key());diff --git a/test/collection_all_fields_test.cpp b/test/collection_all_fields_test.cppindex 8cd97179..7b0539fc 100644--- a/test/collection_all_fields_test.cpp+++ b/test/collection_all_fields_test.cpp@@ -1252,6 +1252,11 @@ TEST_F(CollectionAllFieldsTest, DoNotIndexFieldMarkedAsNonIndex) {ASSERT_FALSE(res_op.ok());ASSERT_EQ("Field `post` is marked as a non-indexed field in the schema.", res_op.error());+ // wildcard pattern should exclude non-indexed field while searching,+ res_op = coll1->search("Amazon", {"*"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, {false});+ ASSERT_TRUE(res_op.ok());+ ASSERT_EQ(1, res_op.get()["hits"].size());+// try updating a document with non-indexable fielddoc["post"] = "Some post updated.";auto update_op = coll1->add(doc.dump(), UPDATE, "0");