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
Consider cross field matching during token splitting.
Kishore Nallan623a65c5385d
diff --git a/src/index.cpp b/src/index.cppindex 3be32394..bd36cec6 100644--- a/src/index.cpp+++ b/src/index.cpp@@ -5514,7 +5514,7 @@ void Index::resolve_space_as_typos(std::vector<std::string>& qtokens, const strileaves.push_back(leaf);}- if(candidate_tokens.size() == leaves.size() && common_results_exist(leaves, false)) {+ if(common_results_exist(leaves, false)) {resolved_queries.push_back(candidate_tokens);return;}diff --git a/test/collection_specific_more_test.cpp b/test/collection_specific_more_test.cppindex 64ad5be6..be76ec9c 100644--- a/test/collection_specific_more_test.cpp+++ b/test/collection_specific_more_test.cpp@@ -609,3 +609,25 @@ TEST_F(CollectionSpecificMoreTest, ExactFilteringOnArray) {ASSERT_EQ(0, results["hits"].size());}++TEST_F(CollectionSpecificMoreTest, SplitTokensCrossFieldMatching) {+ std::vector<field> fields = {field("name", field_types::STRING, false),+ field("brand", field_types::STRING, false),};++ Collection* coll1 = collectionManager.create_collection("coll1", 1, fields).get();++ nlohmann::json doc1;+ doc1["id"] = "0";+ doc1["name"] = "Vitamin C1";+ doc1["brand"] = "Paulas Choice";++ ASSERT_TRUE(coll1->add(doc1.dump()).ok());++ auto results = coll1->search("paulaschoice c1", {"name", "brand"},+ "", {}, {}, {2}, 10,+ 1, FREQUENCY, {true},+ 0).get();++ ASSERT_EQ(1, results["hits"].size());+ collectionManager.drop_collection("coll1");+}diff --git a/test/collection_specific_test.cpp b/test/collection_specific_test.cppindex 528442b8..eaaebb83 100644--- a/test/collection_specific_test.cpp+++ b/test/collection_specific_test.cpp@@ -2076,6 +2076,9 @@ TEST_F(CollectionSpecificTest, SearchShouldSplitAndJoinTokens) {results = coll1->search("the pressurecooker", {"title"}, "", {}, {}, {0}, 10, 1, FREQUENCY, {false}, 0).get();ASSERT_EQ(1, results["hits"].size());+ results = coll1->search("pressurecooker great", {"title"}, "", {}, {}, {0}, 10, 1, FREQUENCY, {false}, 0).get();+ ASSERT_EQ(1, results["hits"].size());+// splitting requires tokens to co-occur as a phrase in the datasetresults = coll1->search("the pressureis", {"title"}, "", {}, {}, {0}, 10, 1, FREQUENCY, {false}, 0).get();