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 tests.
Kishore Nallan4608b9407f54
diff --git a/include/facet_index.h b/include/facet_index.hindex 2e438420..c7e2e288 100644--- a/include/facet_index.h+++ b/include/facet_index.h@@ -6,6 +6,7 @@#include <posting_list.h>#include <num_tree.h>#include <list>+#include <field.h>struct facet_value_id_t {std::string facet_value;@@ -125,7 +126,7 @@ public:size_t get_facet_count(const std::string& field_name);- size_t intersect(const std::string& field_name,+ size_t intersect(facet& a_facet,bool has_facet_query, const std::vector<std::string>& fvalue_searched_tokens,const uint32_t* result_ids, size_t result_id_len,size_t max_facet_count, std::map<std::string, uint32_t>& found,diff --git a/src/facet_index.cpp b/src/facet_index.cppindex 8e55d4f6..ca0805a4 100644--- a/src/facet_index.cpp+++ b/src/facet_index.cpp@@ -145,14 +145,14 @@ size_t facet_index_t::get_facet_count(const std::string& field_name) {}//returns the count of matching seq_ids from result array-size_t facet_index_t::intersect(const std::string& field_name,+size_t facet_index_t::intersect(facet& a_facet,bool has_facet_query, const std::vector<std::string>& fvalue_searched_tokens,const uint32_t* result_ids, size_t result_ids_len,size_t max_facet_count, std::map<std::string, uint32_t>& found,bool is_wildcard_no_filter_query) {//LOG (INFO) << "intersecting field " << field;- const auto& facet_field_it = facet_field_map.find(field_name);+ const auto& facet_field_it = facet_field_map.find(a_facet.field_name);if(facet_field_it == facet_field_map.end()) {return 0;}@@ -179,6 +179,7 @@ size_t facet_index_t::intersect(const std::string& field_name,for(const auto& searched_token: fvalue_searched_tokens) {if(facet_str.find(searched_token) != std::string::npos) {found_search_token = true;+ a_facet.fvalue_tokens[facet_count.facet_value] = fvalue_searched_tokens;break;}}diff --git a/src/index.cpp b/src/index.cppindex ee9c1d65..474f24a7 100644--- a/src/index.cpp+++ b/src/index.cpp@@ -1292,7 +1292,7 @@ void Index::do_facets(std::vector<facet> & facets, facet_query_t & facet_query,std::map<std::string, uint32_t> facet_results;- facet_index_v4->intersect(facet_field.name, use_facet_query,+ facet_index_v4->intersect(a_facet, use_facet_query,facet_infos[findex].fvalue_searched_tokens, result_ids,results_size, max_facet_count, facet_results, is_wildcard_no_filter_query);diff --git a/test/collection_optimized_faceting_test.cpp b/test/collection_optimized_faceting_test.cppindex fcbd74ab..5195d501 100644--- a/test/collection_optimized_faceting_test.cpp+++ b/test/collection_optimized_faceting_test.cpp@@ -314,10 +314,10 @@ TEST_F(CollectionOptimizedFacetingTest, FacetCounts) {ASSERT_STREQ("<mark>7</mark>.812", results["facet_counts"][0]["counts"][0]["highlighted"].get<std::string>().c_str());ASSERT_EQ(5, results["facet_counts"][0]["stats"].size());- ASSERT_FLOAT_EQ(4.880199885368347, results["facet_counts"][0]["stats"]["avg"].get<double>());- ASSERT_FLOAT_EQ(0.0, results["facet_counts"][0]["stats"]["min"].get<double>());- ASSERT_FLOAT_EQ(9.99899959564209, results["facet_counts"][0]["stats"]["max"].get<double>());- ASSERT_FLOAT_EQ(24.400999426841736, results["facet_counts"][0]["stats"]["sum"].get<double>());+ ASSERT_FLOAT_EQ(7.812, results["facet_counts"][0]["stats"]["avg"].get<double>());+ ASSERT_FLOAT_EQ(7.812, results["facet_counts"][0]["stats"]["min"].get<double>());+ ASSERT_FLOAT_EQ(7.812, results["facet_counts"][0]["stats"]["max"].get<double>());+ ASSERT_FLOAT_EQ(7.812, results["facet_counts"][0]["stats"]["sum"].get<double>());ASSERT_FLOAT_EQ(1, results["facet_counts"][0]["stats"]["total_values"].get<size_t>());// facet with wildcard