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
Semantic search faceting should work only on k returned docs.
Kishore Nallan0bf866932775
diff --git a/src/index.cpp b/src/index.cppindex 8d206375..48528f5f 100644--- a/src/index.cpp+++ b/src/index.cpp@@ -3543,7 +3543,7 @@ Option<bool> Index::search(std::vector<query_tokens_t>& field_query_tokens, consbool estimate_facets = (facet_sample_percent > 0 && facet_sample_percent < 100 &&all_result_ids_len > facet_sample_threshold);- bool is_wildcard_no_filter_query = is_wildcard_non_phrase_query && no_filters_provided;+ bool is_wildcard_no_filter_query = is_wildcard_non_phrase_query && no_filters_provided && vector_query.field_name.empty();if(!facets.empty()) {const size_t num_threads = std::min(concurrency, all_result_ids_len);diff --git a/test/collection_vector_search_test.cpp b/test/collection_vector_search_test.cppindex e2ae8f1a..45a893be 100644--- a/test/collection_vector_search_test.cpp+++ b/test/collection_vector_search_test.cpp@@ -74,7 +74,7 @@ TEST_F(CollectionVectorTest, BasicVectorQuerying) {"name": "coll1","fields": [{"name": "title", "type": "string"},- {"name": "points", "type": "int32"},+ {"name": "points", "type": "int32", "facet": true},{"name": "vec", "type": "float[]", "num_dim": 4}]})"_json;@@ -221,6 +221,21 @@ TEST_F(CollectionVectorTest, BasicVectorQuerying) {ASSERT_EQ(1, results["hits"].size());+ results = coll1->search("*", {}, "", {"points"}, {}, {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:([0.96826, 0.94, 0.39557, 0.306488], k: 1)",+ true, 0, max_score, 100,+ 0, 0, "top_values").get();++ ASSERT_EQ(1, results["hits"].size());+ ASSERT_EQ(1, results["facet_counts"].size());+ ASSERT_EQ(1, results["facet_counts"][0]["counts"].size());+ ASSERT_EQ("1", results["facet_counts"][0]["counts"][0]["value"]);+// when k is not set, should use per_pageresults = coll1->search("*", {}, "", {}, {}, {0}, 2, 1, FREQUENCY, {true}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),