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
Field level prefix configuration.
Kishore Nallanb141e01b1bee
diff --git a/include/collection.h b/include/collection.hindex 9bb556a4..7be7842c 100644--- a/include/collection.h+++ b/include/collection.h@@ -513,7 +513,7 @@ public:const std::string & simple_filter_query, const std::vector<std::string> & facet_fields,const std::vector<sort_by> & sort_fields, const std::vector<uint32_t>& num_typos,size_t per_page = 10, size_t page = 1,- token_ordering token_order = FREQUENCY, bool prefix = false,+ token_ordering token_order = FREQUENCY, const std::vector<bool>& prefixes = {false},size_t drop_tokens_threshold = Index::DROP_TOKENS_THRESHOLD,const spp::sparse_hash_set<std::string> & include_fields = spp::sparse_hash_set<std::string>(),const spp::sparse_hash_set<std::string> & exclude_fields = spp::sparse_hash_set<std::string>(),diff --git a/include/index.h b/include/index.hindex cc3e0b72..fcd1057c 100644--- a/include/index.h+++ b/include/index.h@@ -57,7 +57,7 @@ struct search_args {size_t per_page;size_t page;token_ordering token_order;- bool prefix;+ std::vector<bool> prefixes;size_t drop_tokens_threshold;size_t typo_tokens_threshold;std::vector<std::string> group_by_fields;@@ -80,7 +80,8 @@ struct search_args {std::vector<search_field_t> search_fields, std::vector<filter> filters,std::vector<facet> facets, std::map<size_t, std::map<size_t, uint32_t>> included_ids, std::vector<uint32_t> excluded_ids,std::vector<sort_by> sort_fields_std, facet_query_t facet_query, const std::vector<uint32_t>& num_typos,- size_t max_facet_values, size_t max_hits, size_t per_page, size_t page, token_ordering token_order, bool prefix,+ size_t max_facet_values, size_t max_hits, size_t per_page, size_t page, token_ordering token_order,+ const std::vector<bool>& prefixes,size_t drop_tokens_threshold, size_t typo_tokens_threshold,const std::vector<std::string>& group_by_fields, size_t group_limit,const std::string& default_sorting_field,@@ -89,7 +90,7 @@ struct search_args {search_fields(search_fields), filters(filters), facets(facets),included_ids(included_ids), excluded_ids(excluded_ids), sort_fields_std(sort_fields_std),facet_query(facet_query), num_typos(num_typos), max_facet_values(max_facet_values), per_page(per_page),- page(page), token_order(token_order), prefix(prefix),+ page(page), token_order(token_order), prefixes(prefixes),drop_tokens_threshold(drop_tokens_threshold), typo_tokens_threshold(typo_tokens_threshold),group_by_fields(group_by_fields), group_limit(group_limit), default_sorting_field(default_sorting_field),prioritize_exact_match(prioritize_exact_match), all_result_ids_len(0) {@@ -348,7 +349,7 @@ public:const std::vector<sort_by> & sort_fields_std, const std::vector<uint32_t>& num_typos,Topster* topster, Topster* curated_topster,const size_t per_page, const size_t page, const token_ordering token_order,- const bool prefix, const size_t drop_tokens_threshold,+ const std::vector<bool>& prefixes, const size_t drop_tokens_threshold,size_t & all_result_ids_len,spp::sparse_hash_set<uint64_t>& groups_processed,std::vector<std::vector<art_leaf*>> & searched_queries,diff --git a/src/collection.cpp b/src/collection.cppindex 5172730f..1ac59f11 100644--- a/src/collection.cpp+++ b/src/collection.cpp@@ -486,7 +486,7 @@ Option<nlohmann::json> Collection::search(const std::string & query, const std::const std::string & simple_filter_query, const std::vector<std::string>& facet_fields,const std::vector<sort_by> & sort_fields, const std::vector<uint32_t>& num_typos,const size_t per_page, const size_t page,- token_ordering token_order, const bool prefix,+ token_ordering token_order, const std::vector<bool>& prefixes,const size_t drop_tokens_threshold,const spp::sparse_hash_set<std::string> & include_fields,const spp::sparse_hash_set<std::string> & exclude_fields,@@ -530,6 +530,13 @@ Option<nlohmann::json> Collection::search(const std::string & query, const std::}}+ if(!search_fields.empty() && search_fields.size() != prefixes.size()) {+ if(prefixes.size() != 1) {+ return Option<nlohmann::json>(400, "Number of prefix values in `prefix` does not match "+ "number of `query_by` fields.");+ }+ }+std::vector<uint32_t> excluded_ids;std::map<size_t, std::vector<uint32_t>> include_ids; // position => list of IDsstd::map<size_t, std::vector<std::string>> pinned_hits;@@ -900,7 +907,7 @@ Option<nlohmann::json> Collection::search(const std::string & query, const std::filters, facets, index_to_included_ids[index_id],index_to_excluded_ids[index_id],sort_fields_std, facet_query, num_typos, max_facet_values, max_hits,- per_page, page, token_order, prefix,+ per_page, page, token_order, prefixes,drop_tokens_threshold, typo_tokens_threshold,group_by_fields, group_limit, default_sorting_field, prioritize_exact_match);diff --git a/src/collection_manager.cpp b/src/collection_manager.cppindex 05eb42b8..4d328534 100644--- a/src/collection_manager.cpp+++ b/src/collection_manager.cpp@@ -712,7 +712,19 @@ Option<bool> CollectionManager::do_search(std::map<std::string, std::string>& rereturn Option<bool>(404, "Not found.");}- bool prefix = (req_params[PREFIX] == "true");+ std::vector<bool> prefixes;++ if(req_params[PREFIX] == "true" || req_params[PREFIX] == "false") {+ prefixes.push_back(req_params[PREFIX] == "true");+ } else {+ std::vector<std::string> prefix_str;+ StringUtils::split(req_params[PREFIX], prefix_str, ",");+ for(auto& prefix_s : prefix_str) {+ prefixes.push_back(prefix_s == "true");+ }+ }++const size_t drop_tokens_threshold = (size_t) std::stoi(req_params[DROP_TOKENS_THRESHOLD]);const size_t typo_tokens_threshold = (size_t) std::stoi(req_params[TYPO_TOKENS_THRESHOLD]);@@ -731,7 +743,7 @@ Option<bool> CollectionManager::do_search(std::map<std::string, std::string>& resort_fields, num_typos,static_cast<size_t>(std::stol(req_params[PER_PAGE])),static_cast<size_t>(std::stol(req_params[PAGE])),- token_order, prefix, drop_tokens_threshold,+ token_order, prefixes, drop_tokens_threshold,include_fields, exclude_fields,static_cast<size_t>(std::stol(req_params[MAX_FACET_VALUES])),req_params[FACET_QUERY],diff --git a/src/index.cpp b/src/index.cppindex d123614d..93f157a8 100644--- a/src/index.cpp+++ b/src/index.cpp@@ -1398,7 +1398,7 @@ void Index::run_search(search_args* search_params) {search_params->sort_fields_std, search_params->num_typos,search_params->topster, search_params->curated_topster,search_params->per_page, search_params->page, search_params->token_order,- search_params->prefix, search_params->drop_tokens_threshold,+ search_params->prefixes, search_params->drop_tokens_threshold,search_params->all_result_ids_len, search_params->groups_processed,search_params->searched_queries,search_params->raw_result_kvs, search_params->override_result_kvs,@@ -1487,7 +1487,7 @@ void Index::search(const std::vector<query_tokens_t>& field_query_tokens,Topster* topster,Topster* curated_topster,const size_t per_page, const size_t page, const token_ordering token_order,- const bool prefix, const size_t drop_tokens_threshold,+ const std::vector<bool>& prefixes, const size_t drop_tokens_threshold,size_t & all_result_ids_len,spp::sparse_hash_set<uint64_t>& groups_processed,std::vector<std::vector<art_leaf*>>& searched_queries,@@ -1631,6 +1631,8 @@ void Index::search(const std::vector<query_tokens_t>& field_query_tokens,// num_typos is already validated upstream, but still playing safeint field_num_typos = (i < num_typos.size()) ? num_typos[i] : num_typos[0];+ bool field_prefix = (i < prefixes.size()) ? prefixes[i] : prefixes[0];+// proceed to query search only when no filters are provided or when filtering produces resultsif(filters.empty() || filter_ids_length > 0) {const uint8_t field_id = (uint8_t)(FIELD_LIMIT_NUM - i);@@ -1653,7 +1655,7 @@ void Index::search(const std::vector<query_tokens_t>& field_query_tokens,search_field(field_id, query_tokens, search_tokens, exclude_token_ids, exclude_token_ids_size, num_tokens_dropped,field_name, filter_ids, filter_ids_length, curated_ids_sorted, facets, sort_fields_std,field_num_typos, searched_queries, actual_topster, groups_processed, &all_result_ids, all_result_ids_len,- field_num_results, group_limit, group_by_fields, prioritize_exact_match, token_order, prefix,+ field_num_results, group_limit, group_by_fields, prioritize_exact_match, token_order, field_prefix,drop_tokens_threshold, typo_tokens_threshold);// do synonym based searches@@ -1665,7 +1667,7 @@ void Index::search(const std::vector<query_tokens_t>& field_query_tokens,search_field(field_id, query_tokens, search_tokens, exclude_token_ids, exclude_token_ids_size, num_tokens_dropped,field_name, filter_ids, filter_ids_length, curated_ids_sorted, facets, sort_fields_std,field_num_typos, searched_queries, actual_topster, groups_processed, &all_result_ids, all_result_ids_len,- field_num_results, group_limit, group_by_fields, prioritize_exact_match, token_order, prefix,+ field_num_results, group_limit, group_by_fields, prioritize_exact_match, token_order, field_prefix,drop_tokens_threshold, typo_tokens_threshold);}@@ -1731,6 +1733,7 @@ void Index::search(const std::vector<query_tokens_t>& field_query_tokens,}const std::string& field = search_fields[i].name;+ const bool field_prefix = (i < prefixes.size()) ? prefixes[i] : prefixes[0];// compute approximate match score for this field from actual query@@ -1740,7 +1743,7 @@ void Index::search(const std::vector<query_tokens_t>& field_query_tokens,const auto& token = field_query_tokens[i].q_include_tokens[token_index];std::vector<art_leaf*> leaves;- const bool prefix_search = prefix && (token_index == field_query_tokens[i].q_include_tokens.size()-1);+ const bool prefix_search = field_prefix && (token_index == field_query_tokens[i].q_include_tokens.size()-1);const size_t token_len = prefix_search ? (int) token.length() : (int) token.length() + 1;art_fuzzy_search(search_index.at(field), (const unsigned char *) token.c_str(), token_len,0, 0, 1, token_order, prefix_search, nullptr, 0, leaves);diff --git a/test/collection_all_fields_test.cpp b/test/collection_all_fields_test.cppindex d8589516..0c423cab 100644--- a/test/collection_all_fields_test.cpp+++ b/test/collection_all_fields_test.cpp@@ -83,7 +83,7 @@ TEST_F(CollectionAllFieldsTest, IndexDocsWithoutSchema) {ASSERT_EQ(DIRTY_VALUES::DROP, coll1->parse_dirty_values_option(dirty_values));// same should succeed when verbatim filter is made- auto results = coll1->search("will", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ auto results = coll1->search("will", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(2, results["hits"].size());ASSERT_EQ(2, results["found"].get<size_t>());@@ -91,7 +91,7 @@ TEST_F(CollectionAllFieldsTest, IndexDocsWithoutSchema) {ASSERT_STREQ("1", results["hits"][0]["document"]["id"].get<std::string>().c_str());ASSERT_STREQ("0", results["hits"][1]["document"]["id"].get<std::string>().c_str());- results = coll1->search("chris", {"cast"}, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll1->search("chris", {"cast"}, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(3, results["hits"].size());ASSERT_EQ(3, results["found"].get<size_t>());@@ -118,7 +118,7 @@ TEST_F(CollectionAllFieldsTest, IndexDocsWithoutSchema) {add_op = coll1->add(doc_json);ASSERT_TRUE(add_op.ok());- results = coll1->search("300", {"title"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll1->search("300", {"title"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(1, results["hits"].size());ASSERT_STREQ("300", results["hits"][0]["document"]["title"].get<std::string>().c_str());@@ -130,7 +130,7 @@ TEST_F(CollectionAllFieldsTest, IndexDocsWithoutSchema) {add_op = coll1->add(doc_json, CREATE, "", DIRTY_VALUES::COERCE_OR_DROP);ASSERT_TRUE(add_op.ok());- results = coll1->search("With bad cast field", {"title"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll1->search("With bad cast field", {"title"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(1, results["hits"].size());ASSERT_STREQ("With bad cast field.", results["hits"][0]["document"]["title"].get<std::string>().c_str());ASSERT_EQ(0, results["hits"][0]["document"].count("cast"));@@ -143,10 +143,10 @@ TEST_F(CollectionAllFieldsTest, IndexDocsWithoutSchema) {add_op = coll1->add(doc_json, CREATE, "", DIRTY_VALUES::DROP);ASSERT_TRUE(add_op.ok());- results = coll1->search("1200", {"title"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll1->search("1200", {"title"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(0, results["hits"].size());- results = coll1->search("Jeremy Livingston", {"cast"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll1->search("Jeremy Livingston", {"cast"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(1, results["hits"].size());ASSERT_EQ(0, results["hits"][0]["document"].count("title"));@@ -160,7 +160,7 @@ TEST_F(CollectionAllFieldsTest, IndexDocsWithoutSchema) {// try querying using an non-existing sort fieldsort_fields = { sort_by("not-found", "DESC") };- auto res_op = coll1->search("*", {}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, false);+ auto res_op = coll1->search("*", {}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, {false});ASSERT_FALSE(res_op.ok());ASSERT_EQ("Could not find a field named `not-found` in the schema for sorting.", res_op.error());@@ -213,7 +213,7 @@ TEST_F(CollectionAllFieldsTest, HandleArrayTypes) {add_op = coll1->add(doc.dump(), CREATE, "", DIRTY_VALUES:: DROP);ASSERT_TRUE(add_op.ok());- auto results = coll1->search("second", {"title"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ auto results = coll1->search("second", {"title"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(1, results["hits"].size());// check that the "bad" value does not exists in the stored document@@ -234,7 +234,7 @@ TEST_F(CollectionAllFieldsTest, HandleArrayTypes) {add_op = coll1->add(doc.dump(), CREATE, "", DIRTY_VALUES::COERCE_OR_DROP);ASSERT_TRUE(add_op.ok());- results = coll1->search("third", {"title"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll1->search("third", {"title"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(1, results["hits"].size());ASSERT_EQ(0, results["hits"][0]["document"].count("int_values"));@@ -294,7 +294,7 @@ TEST_F(CollectionAllFieldsTest, ShouldBeAbleToUpdateSchemaDetectedDocs) {add_op = coll1->add(doc.dump(), UPDATE, "0", DIRTY_VALUES::COERCE_OR_DROP);ASSERT_TRUE(add_op.ok());- auto results = coll1->search("second", {"title"}, "", {}, {}, {0}, 10, 1, FREQUENCY, false).get();+ auto results = coll1->search("second", {"title"}, "", {}, {}, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(1, results["hits"].size());ASSERT_EQ("SECOND", results["hits"][0]["document"]["title"].get<std::string>());@@ -341,7 +341,7 @@ TEST_F(CollectionAllFieldsTest, ShouldBeAbleToUpdateSchemaDetectedDocs) {res = coll1->add_many(json_lines, insert_doc, UPDATE);ASSERT_TRUE(res["success"].get<bool>());- results = coll1->search("updated", {"title"}, "", {}, {}, {0}, 50, 1, FREQUENCY, false).get();+ results = coll1->search("updated", {"title"}, "", {}, {}, {0}, 50, 1, FREQUENCY, {false}).get();ASSERT_EQ(20, results["hits"].size());for(auto& hit: results["hits"]) {@@ -373,7 +373,7 @@ TEST_F(CollectionAllFieldsTest, StringifyAllValues) {ASSERT_EQ("1", added_doc["int_values"][0].get<std::string>());ASSERT_EQ("2", added_doc["int_values"][1].get<std::string>());- auto results = coll1->search("first", {"title"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ auto results = coll1->search("first", {"title"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(1, results["hits"].size());ASSERT_EQ("FIRST", results["hits"][0]["document"]["title"].get<std::string>());@@ -387,7 +387,7 @@ TEST_F(CollectionAllFieldsTest, StringifyAllValues) {add_op = coll1->add(doc.dump(), CREATE, "", DIRTY_VALUES::DROP);ASSERT_TRUE(add_op.ok());- results = coll1->search("second", {"title"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll1->search("second", {"title"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(1, results["hits"].size());ASSERT_EQ("SECOND", results["hits"][0]["document"]["title"].get<std::string>());ASSERT_EQ(1, results["hits"][0]["document"].count("int_values"));@@ -424,7 +424,7 @@ TEST_F(CollectionAllFieldsTest, StringifyAllValues) {add_op = coll1->add(doc.dump(), CREATE, "", DIRTY_VALUES::DROP);ASSERT_TRUE(add_op.ok());- results = coll1->search("fifth", {"title"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll1->search("fifth", {"title"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(1, results["hits"].size());ASSERT_EQ("FIFTH", results["hits"][0]["document"]["title"].get<std::string>());ASSERT_EQ(0, results["hits"][0]["document"].count("dict"));@@ -434,7 +434,7 @@ TEST_F(CollectionAllFieldsTest, StringifyAllValues) {add_op = coll1->add(doc.dump(), CREATE, "66", DIRTY_VALUES::COERCE_OR_DROP);ASSERT_TRUE(add_op.ok());- results = coll1->search("sixth", {"title"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll1->search("sixth", {"title"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(1, results["hits"].size());ASSERT_EQ("SIXTH", results["hits"][0]["document"]["title"].get<std::string>());ASSERT_EQ(0, results["hits"][0]["document"].count("dict"));@@ -464,11 +464,11 @@ TEST_F(CollectionAllFieldsTest, SearchStringifiedField) {Option<nlohmann::json> add_op = coll1->add(doc.dump(), CREATE, "0");ASSERT_TRUE(add_op.ok());- auto results_op = coll1->search("stark", {"company_name"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, false);+ auto results_op = coll1->search("stark", {"company_name"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, {false});ASSERT_TRUE(results_op.ok());ASSERT_EQ(1, results_op.get()["hits"].size());- results_op = coll1->search("engineering", {"department"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, false);+ results_op = coll1->search("engineering", {"department"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, {false});ASSERT_TRUE(results_op.ok());ASSERT_EQ(1, results_op.get()["hits"].size());@@ -501,7 +501,7 @@ TEST_F(CollectionAllFieldsTest, StringSingularAllValues) {ASSERT_EQ("FIRST", added_doc["title"].get<std::string>());ASSERT_EQ("123", added_doc["int_values"].get<std::string>());- auto results = coll1->search("first", {"title"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ auto results = coll1->search("first", {"title"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(1, results["hits"].size());ASSERT_EQ("FIRST", results["hits"][0]["document"]["title"].get<std::string>());ASSERT_EQ("123", results["hits"][0]["document"]["int_values"].get<std::string>());@@ -674,7 +674,7 @@ TEST_F(CollectionAllFieldsTest, WildcardFacetFieldsOnAutoSchema) {add_op = coll1->add(doc.dump(), CREATE);ASSERT_TRUE(add_op.ok());- auto results = coll1->search("org", {"title"}, "", {"org_name"}, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ auto results = coll1->search("org", {"title"}, "", {"org_name"}, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(2, results["hits"].size());ASSERT_EQ("Walmart", results["hits"][0]["document"]["org_name"].get<std::string>());@@ -695,7 +695,7 @@ TEST_F(CollectionAllFieldsTest, WildcardFacetFieldsOnAutoSchema) {add_op = coll1->add(doc.dump(), CREATE);ASSERT_TRUE(add_op.ok());- results = coll1->search("*", {"title"}, "", {"company_name", "org_name"}, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll1->search("*", {"title"}, "", {"company_name", "org_name"}, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(3, results["hits"].size());ASSERT_EQ("company_name", results["facet_counts"][0]["field_name"].get<std::string>());@@ -739,7 +739,7 @@ TEST_F(CollectionAllFieldsTest, WildcardFacetFieldsWithAuoFacetFieldType) {add_op = coll1->add(doc.dump(), CREATE);ASSERT_TRUE(add_op.ok());- auto results = coll1->search("org", {"title"}, "", {"org_name"}, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ auto results = coll1->search("org", {"title"}, "", {"org_name"}, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(2, results["hits"].size());ASSERT_EQ("Walmart", results["hits"][0]["document"]["org_name"].get<std::string>());@@ -778,7 +778,7 @@ TEST_F(CollectionAllFieldsTest, WildcardFacetFieldsWithoutAutoSchema) {add_op = coll1->add(doc.dump(), CREATE);ASSERT_TRUE(add_op.ok());- auto results = coll1->search("org", {"title"}, "", {"org_name"}, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ auto results = coll1->search("org", {"title"}, "", {"org_name"}, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(2, results["hits"].size());ASSERT_EQ("Walmart", results["hits"][0]["document"]["org_name"].get<std::string>());@@ -799,7 +799,7 @@ TEST_F(CollectionAllFieldsTest, WildcardFacetFieldsWithoutAutoSchema) {add_op = coll1->add(doc.dump(), CREATE);ASSERT_TRUE(add_op.ok());- results = coll1->search("*", {"title"}, "", {"company_name", "org_name"}, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll1->search("*", {"title"}, "", {"company_name", "org_name"}, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(3, results["hits"].size());ASSERT_EQ("company_name", results["facet_counts"][0]["field_name"].get<std::string>());@@ -820,7 +820,7 @@ TEST_F(CollectionAllFieldsTest, WildcardFacetFieldsWithoutAutoSchema) {add_op = coll1->add(doc.dump(), CREATE);ASSERT_TRUE(add_op.ok());- auto res_op = coll1->search("*", {"description"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, false);+ auto res_op = coll1->search("*", {"description"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, {false});ASSERT_FALSE(res_op.ok());ASSERT_EQ("Could not find a field named `description` in the schema.", res_op.error());@@ -896,17 +896,17 @@ TEST_F(CollectionAllFieldsTest, BothFallbackAndDynamicFields) {auto add_op = coll1->add(doc.dump(), CREATE);ASSERT_TRUE(add_op.ok());- auto res_op = coll1->search("Amazon", {"org_name"}, "", {"org_name"}, sort_fields, {0}, 10, 1, FREQUENCY, false);+ auto res_op = coll1->search("Amazon", {"org_name"}, "", {"org_name"}, sort_fields, {0}, 10, 1, FREQUENCY, {false});ASSERT_FALSE(res_op.ok());ASSERT_EQ("Could not find a facet field named `org_name` in the schema.", res_op.error());- auto results = coll1->search("Amazon", {"org_name"}, "", {"org_year"}, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ auto results = coll1->search("Amazon", {"org_name"}, "", {"org_year"}, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(1, results["hits"].size());- res_op = coll1->search("fizzbuzz", {"rand_str"}, "", {"rand_str"}, sort_fields, {0}, 10, 1, FREQUENCY, false);+ res_op = coll1->search("fizzbuzz", {"rand_str"}, "", {"rand_str"}, sort_fields, {0}, 10, 1, FREQUENCY, {false});ASSERT_EQ("Could not find a facet field named `rand_str` in the schema.", res_op.error());- results = coll1->search("fizzbuzz", {"rand_str"}, "", {"org_year"}, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll1->search("fizzbuzz", {"rand_str"}, "", {"org_year"}, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(1, results["hits"].size());collectionManager.drop_collection("coll1");@@ -965,11 +965,11 @@ TEST_F(CollectionAllFieldsTest, DoNotIndexFieldMarkedAsNonIndex) {ASSERT_EQ(0, coll1->_get_indexes()[0]->_get_search_index().count("post"));- auto res_op = coll1->search("Amazon", {"description_txt"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, false);+ auto res_op = coll1->search("Amazon", {"description_txt"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, {false});ASSERT_FALSE(res_op.ok());ASSERT_EQ("Could not find a field named `description_txt` in the schema.", res_op.error());- res_op = coll1->search("Amazon", {"post"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, false);+ res_op = coll1->search("Amazon", {"post"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, {false});ASSERT_FALSE(res_op.ok());ASSERT_EQ("Field `post` is marked as a non-indexed field in the schema.", res_op.error());@@ -980,7 +980,7 @@ TEST_F(CollectionAllFieldsTest, DoNotIndexFieldMarkedAsNonIndex) {ASSERT_EQ(0, coll1->_get_indexes()[0]->_get_search_index().count("post"));- auto res = coll1->search("Amazon", {"company_name"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ auto res = coll1->search("Amazon", {"company_name"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ("Some post updated.", res["hits"][0]["document"]["post"].get<std::string>());// try to delete doc with non-indexable field@@ -988,7 +988,7 @@ TEST_F(CollectionAllFieldsTest, DoNotIndexFieldMarkedAsNonIndex) {ASSERT_TRUE(del_op.ok());// facet search should also be disabled- auto fs_op = coll1->search("Amazon", {"company_name"}, "", {"description_txt"}, sort_fields, {0}, 10, 1, FREQUENCY, false);+ auto fs_op = coll1->search("Amazon", {"company_name"}, "", {"description_txt"}, sort_fields, {0}, 10, 1, FREQUENCY, {false});ASSERT_FALSE(fs_op.ok());ASSERT_EQ("Could not find a facet field named `description_txt` in the schema.", fs_op.error());diff --git a/test/collection_faceting_test.cpp b/test/collection_faceting_test.cppindex 3aba9e64..4dfd4064 100644--- a/test/collection_faceting_test.cpp+++ b/test/collection_faceting_test.cpp@@ -68,7 +68,7 @@ TEST_F(CollectionFacetingTest, FacetCounts) {std::vector<std::string> facets = {"tags"};// single facet with no filters- nlohmann::json results = coll_array_fields->search("Jeremy", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ nlohmann::json results = coll_array_fields->search("Jeremy", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(5, results["hits"].size());ASSERT_EQ(1, results["facet_counts"].size());@@ -91,7 +91,7 @@ TEST_F(CollectionFacetingTest, FacetCounts) {// facet with facet count limitresults = coll_array_fields->search("Jeremy", query_fields, "", facets, sort_fields, {0}, 10, 1,- FREQUENCY, false, 10, spp::sparse_hash_set<std::string>(),+ FREQUENCY, {false}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 2).get();ASSERT_EQ(5, results["hits"].size());@@ -109,7 +109,7 @@ TEST_F(CollectionFacetingTest, FacetCounts) {facets.clear();facets.push_back("tags");facets.push_back("name_facet");- results = coll_array_fields->search("Jeremy", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(5, results["hits"].size());ASSERT_EQ(2, results["facet_counts"].size());@@ -124,7 +124,7 @@ TEST_F(CollectionFacetingTest, FacetCounts) {// facet with filtersfacets.clear();facets.push_back("tags");- results = coll_array_fields->search("Jeremy", query_fields, "age: >24", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "age: >24", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(3, results["hits"].size());ASSERT_EQ(1, results["facet_counts"].size());@@ -143,7 +143,7 @@ TEST_F(CollectionFacetingTest, FacetCounts) {// facet with wildcard queryfacets.clear();facets.push_back("tags");- results = coll_array_fields->search("*", query_fields, "age: >24", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("*", query_fields, "age: >24", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(3, results["hits"].size());ASSERT_EQ(1, results["facet_counts"].size());@@ -161,7 +161,7 @@ TEST_F(CollectionFacetingTest, FacetCounts) {// facet with facet filter query (allows typo correction!)results = coll_array_fields->search("*", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, " tags : sliver").get();@@ -173,7 +173,7 @@ TEST_F(CollectionFacetingTest, FacetCounts) {// facet with facet filter query matching 2 tokensresults = coll_array_fields->search("*", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "tags: fxne aluminium").get();@@ -185,7 +185,7 @@ TEST_F(CollectionFacetingTest, FacetCounts) {// facet with facet filter query matching first token of an arrayresults = coll_array_fields->search("*", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "tags: fine").get();@@ -197,7 +197,7 @@ TEST_F(CollectionFacetingTest, FacetCounts) {// facet with facet filter query matching second token of an arrayresults = coll_array_fields->search("*", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "tags: pltinum").get();@@ -209,7 +209,7 @@ TEST_F(CollectionFacetingTest, FacetCounts) {// facet query on an integer fieldresults = coll_array_fields->search("*", query_fields, "", {"age"}, sort_fields, {0}, 10, 1, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "age: 2").get();@@ -226,7 +226,7 @@ TEST_F(CollectionFacetingTest, FacetCounts) {// facet on a float field without query to check on statsresults = coll_array_fields->search("*", query_fields, "", {"rating"}, sort_fields, {0}, 10, 1, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "").get();ASSERT_EQ(4, results["facet_counts"][0]["stats"].size());@@ -237,7 +237,7 @@ TEST_F(CollectionFacetingTest, FacetCounts) {// facet query on a float fieldresults = coll_array_fields->search("*", query_fields, "", {"rating"}, sort_fields, {0}, 10, 1, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "rating: 7").get();@@ -257,7 +257,7 @@ TEST_F(CollectionFacetingTest, FacetCounts) {// facet query on an array integer fieldresults = coll_array_fields->search("*", query_fields, "", {"timestamps"}, sort_fields, {0}, 10, 1, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "timestamps: 142189002").get();@@ -277,7 +277,7 @@ TEST_F(CollectionFacetingTest, FacetCounts) {// facet query that does not match any indexed valueresults = coll_array_fields->search("*", query_fields, "", {facets}, sort_fields, {0}, 10, 1, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, " tags : notfound").get();@@ -288,14 +288,14 @@ TEST_F(CollectionFacetingTest, FacetCounts) {// empty facet query value should return all facets without any filtering of facetsresults = coll_array_fields->search("*", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "tags: ").get();ASSERT_EQ(5, results["hits"].size());results = coll_array_fields->search("*", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "tags:").get();@@ -303,7 +303,7 @@ TEST_F(CollectionFacetingTest, FacetCounts) {// bad facet query syntaxauto res_op = coll_array_fields->search("*", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "foobar");@@ -312,7 +312,7 @@ TEST_F(CollectionFacetingTest, FacetCounts) {// unknown facet fieldres_op = coll_array_fields->search("*", query_fields, "", {"foobar"}, sort_fields, {0}, 10, 1, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "foobar: baz");@@ -321,7 +321,7 @@ TEST_F(CollectionFacetingTest, FacetCounts) {// when facet query is given but no facet fields are specified, must return an error messageres_op = coll_array_fields->search("*", query_fields, "", {}, sort_fields, {0}, 10, 1, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "tags: foo");@@ -330,7 +330,7 @@ TEST_F(CollectionFacetingTest, FacetCounts) {// given facet query field must be part of facet fields requestedres_op = coll_array_fields->search("*", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "name_facet: jeremy");@@ -339,7 +339,7 @@ TEST_F(CollectionFacetingTest, FacetCounts) {// facet query with multiple colonsres_op = coll_array_fields->search("*", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "tags:foo:bar");@@ -388,7 +388,7 @@ TEST_F(CollectionFacetingTest, FacetCountsBool) {std::vector<std::string> facets = {"in_stock"};nlohmann::json results = coll1->search("*", {"title"}, "in_stock:true", facets, sort_fields, {0}, 10, 1,- token_ordering::FREQUENCY, true, 10, spp::sparse_hash_set<std::string>(),+ token_ordering::FREQUENCY, {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "in_stock:true").get();ASSERT_EQ(1, results["facet_counts"].size());@@ -427,7 +427,7 @@ TEST_F(CollectionFacetingTest, FacetCountsFloatPrecision) {std::vector<std::string> facets = {"points"};nlohmann::json results = coll1->search("*", {"title"}, "", facets, sort_fields, {0}, 10, 1,- token_ordering::FREQUENCY, true).get();+ token_ordering::FREQUENCY, {true}).get();ASSERT_EQ(1, results["facet_counts"].size());ASSERT_EQ(1, results["facet_counts"][0]["counts"].size());@@ -463,7 +463,7 @@ TEST_F(CollectionFacetingTest, FacetCountsHighlighting) {std::vector<std::string> facets = {"categories"};nlohmann::json results = coll1->search("phone", {"categories"}, "", facets, sort_fields, {0}, 10, 1,- token_ordering::FREQUENCY, true, 10, spp::sparse_hash_set<std::string>(),+ token_ordering::FREQUENCY, {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "categories:cell").get();ASSERT_EQ(1, results["facet_counts"].size());@@ -489,7 +489,7 @@ TEST_F(CollectionFacetingTest, FacetCountsHighlighting) {coll1->add(doc.dump());results = coll1->search("phone", {"categories"}, "", facets, sort_fields, {0}, 10, 1,- token_ordering::FREQUENCY, true, 10, spp::sparse_hash_set<std::string>(),+ token_ordering::FREQUENCY, {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "categories:cell").get();ASSERT_EQ(1, results["facet_counts"].size());@@ -512,7 +512,7 @@ TEST_F(CollectionFacetingTest, FacetCountsHighlighting) {coll1->add(doc.dump());results = coll1->search("phone", {"categories"}, "", facets, sort_fields, {0}, 10, 1,- token_ordering::FREQUENCY, true, 10, spp::sparse_hash_set<std::string>(),+ token_ordering::FREQUENCY, {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "categories:acces").get();@@ -526,7 +526,7 @@ TEST_F(CollectionFacetingTest, FacetCountsHighlighting) {// ensure that query is NOT case sensitiveresults = coll1->search("phone", {"categories"}, "", facets, sort_fields, {0}, 10, 1,- token_ordering::FREQUENCY, true, 10, spp::sparse_hash_set<std::string>(),+ token_ordering::FREQUENCY, {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "categories:ACCES").get();ASSERT_EQ(1, results["facet_counts"].size());@@ -543,7 +543,7 @@ TEST_F(CollectionFacetingTest, FacetCountsHighlighting) {coll1->add(doc.dump());results = coll1->search("phone", {"categories"}, "", facets, sort_fields, {0}, 10, 1,- token_ordering::FREQUENCY, true, 10, spp::sparse_hash_set<std::string>(),+ token_ordering::FREQUENCY, {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "categories:cell ph").get();ASSERT_EQ(1, results["facet_counts"].size());@@ -557,7 +557,7 @@ TEST_F(CollectionFacetingTest, FacetCountsHighlighting) {// also ensure that setting per_page = 0 works fineresults = coll1->search("phone", {"categories"}, "", facets, sort_fields, {0}, 0, 1,- token_ordering::FREQUENCY, true, 10, spp::sparse_hash_set<std::string>(),+ token_ordering::FREQUENCY, {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "categories:cellx").get();ASSERT_EQ(0, results["hits"].size());@@ -601,7 +601,7 @@ TEST_F(CollectionFacetingTest, FacetStatOnFloatFields) {query_fields = {"title"};std::vector<std::string> facets;auto res_op = coll_float_fields->search("Jeremy", query_fields, "", {"average"}, sort_fields_desc, {0}, 10,- 1, FREQUENCY, false);+ 1, FREQUENCY, {false});auto results = res_op.get();@@ -614,7 +614,7 @@ TEST_F(CollectionFacetingTest, FacetStatOnFloatFields) {ASSERT_FLOAT_EQ(39.68800011036053, results["facet_counts"][0]["stats"]["avg"].get<double>());results = coll_float_fields->search("*", query_fields, "average:>100", {"average"}, sort_fields_desc, {0}, 10,- 1, FREQUENCY, false).get();+ 1, FREQUENCY, {false}).get();ASSERT_EQ(4, results["facet_counts"][0]["stats"].size());ASSERT_FLOAT_EQ(300, results["facet_counts"][0]["stats"]["avg"].get<double>());@@ -625,7 +625,7 @@ TEST_F(CollectionFacetingTest, FacetStatOnFloatFields) {// facet filter, though should not be considered when calculating facet statsresults = coll_float_fields->search("*", query_fields, "", {"average"}, sort_fields_desc, {0}, 10, 1, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(),10, "average: 11").get();@@ -668,7 +668,7 @@ TEST_F(CollectionFacetingTest, FacetCountOnSimilarStrings) {std::vector<std::string> facets = {"categories"};nlohmann::json results = coll1->search("*", {"categories"}, "points:[25, 50]", facets, sort_fields, {0}, 10, 1,- token_ordering::FREQUENCY, true, 10, spp::sparse_hash_set<std::string>(),+ token_ordering::FREQUENCY, {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10).get();ASSERT_EQ(2, results["hits"].size());diff --git a/test/collection_filtering_test.cpp b/test/collection_filtering_test.cppindex 2202be0c..de1e0a1d 100644--- a/test/collection_filtering_test.cpp+++ b/test/collection_filtering_test.cpp@@ -63,7 +63,7 @@ TEST_F(CollectionFilteringTest, FilterOnTextFields) {query_fields = {"name"};std::vector<std::string> facets;- nlohmann::json results = coll_array_fields->search("Jeremy", query_fields, "tags: gold", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ nlohmann::json results = coll_array_fields->search("Jeremy", query_fields, "tags: gold", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(3, results["hits"].size());std::vector<std::string> ids = {"4", "0", "2"};@@ -75,22 +75,22 @@ TEST_F(CollectionFilteringTest, FilterOnTextFields) {ASSERT_STREQ(id.c_str(), result_id.c_str());}- results = coll_array_fields->search("Jeremy", query_fields, "tags : fine PLATINUM", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "tags : fine PLATINUM", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(1, results["hits"].size());// using just ":", filtering should return documents that contain ALL tokens in the filter expression- results = coll_array_fields->search("Jeremy", query_fields, "tags : PLATINUM", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "tags : PLATINUM", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(1, results["hits"].size());// no documents contain both "white" and "platinum", so- results = coll_array_fields->search("Jeremy", query_fields, "tags : WHITE PLATINUM", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "tags : WHITE PLATINUM", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(0, results["hits"].size());// with exact match operator (:=) partial matches are not allowed- results = coll_array_fields->search("Jeremy", query_fields, "tags:= PLATINUM", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "tags:= PLATINUM", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(0, results["hits"].size());- results = coll_array_fields->search("Jeremy", query_fields, "tags : bronze", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "tags : bronze", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(2, results["hits"].size());ids = {"4", "2"};@@ -103,7 +103,7 @@ TEST_F(CollectionFilteringTest, FilterOnTextFields) {}// search with a list of tags, also testing extra padding of space- results = coll_array_fields->search("Jeremy", query_fields, "tags: [bronze, silver]", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "tags: [bronze, silver]", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(4, results["hits"].size());ids = {"3", "4", "0", "2"};@@ -116,17 +116,17 @@ TEST_F(CollectionFilteringTest, FilterOnTextFields) {}// need to be exact matches- results = coll_array_fields->search("Jeremy", query_fields, "tags: bronze", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "tags: bronze", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(2, results["hits"].size());// when comparators are used, they should be ignored- results = coll_array_fields->search("Jeremy", query_fields, "tags:<bronze", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "tags:<bronze", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(2, results["hits"].size());- results = coll_array_fields->search("Jeremy", query_fields, "tags:<=BRONZE", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "tags:<=BRONZE", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(2, results["hits"].size());- results = coll_array_fields->search("Jeremy", query_fields, "tags:>BRONZE", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "tags:>BRONZE", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(2, results["hits"].size());collectionManager.drop_collection("coll_array_fields");@@ -165,31 +165,31 @@ TEST_F(CollectionFilteringTest, FacetFieldStringFiltering) {// exact filter on string field must fail when single token is usedfacets.clear();facets.emplace_back("starring");- auto results = coll_str->search("*", query_fields, "starring:= samuel", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ auto results = coll_str->search("*", query_fields, "starring:= samuel", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(0, results["hits"].size());ASSERT_EQ(0, results["found"].get<size_t>());// multiple tokens but with a typo on one of them- results = coll_str->search("*", query_fields, "starring:= ssamuel l. Jackson", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_str->search("*", query_fields, "starring:= ssamuel l. Jackson", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(0, results["hits"].size());ASSERT_EQ(0, results["found"].get<size_t>());// same should succeed when verbatim filter is made- results = coll_str->search("*", query_fields, "starring:= samuel l. Jackson", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_str->search("*", query_fields, "starring:= samuel l. Jackson", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(2, results["hits"].size());ASSERT_EQ(2, results["found"].get<size_t>());// contains filter with a single token should work as well- results = coll_str->search("*", query_fields, "starring: jackson", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_str->search("*", query_fields, "starring: jackson", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(2, results["hits"].size());ASSERT_EQ(2, results["found"].get<size_t>());- results = coll_str->search("*", query_fields, "starring: samuel", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_str->search("*", query_fields, "starring: samuel", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(2, results["hits"].size());ASSERT_EQ(2, results["found"].get<size_t>());// contains when only 1 token so should not match- results = coll_str->search("*", query_fields, "starring: samuel johnson", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_str->search("*", query_fields, "starring: samuel johnson", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(0, results["hits"].size());collectionManager.drop_collection("coll_str");@@ -231,46 +231,46 @@ TEST_F(CollectionFilteringTest, FacetFieldStringArrayFiltering) {// facet with filter on string array field must fail when exact token is usedfacets.clear();facets.push_back("tags");- auto results = coll_array_fields->search("Jeremy", query_fields, "tags:= PLATINUM", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ auto results = coll_array_fields->search("Jeremy", query_fields, "tags:= PLATINUM", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(0, results["hits"].size());ASSERT_EQ(0, results["found"].get<size_t>());- results = coll_array_fields->search("Jeremy", query_fields, "tags:= FINE", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "tags:= FINE", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(0, results["hits"].size());- results = coll_array_fields->search("Jeremy", query_fields, "tags:= FFINE PLATINUM", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "tags:= FFINE PLATINUM", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(0, results["hits"].size());// partial token filter should be made without "=" operator- results = coll_array_fields->search("Jeremy", query_fields, "tags: PLATINUM", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "tags: PLATINUM", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(1, results["hits"].size());ASSERT_EQ(1, results["found"].get<size_t>());- results = coll_array_fields->search("Jeremy", query_fields, "tags: FINE", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "tags: FINE", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(1, results["hits"].size());ASSERT_EQ(1, results["found"].get<size_t>());// to make tokens match facet value exactly, use "=" operator- results = coll_array_fields->search("Jeremy", query_fields, "tags:= FINE PLATINUM", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "tags:= FINE PLATINUM", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(1, results["hits"].size());ASSERT_EQ(1, results["found"].get<size_t>());// don't allow exact filter on non-faceted field- auto res_op = coll_array_fields->search("Jeremy", query_fields, "name:= Jeremy Howard", facets, sort_fields, {0}, 10, 1, FREQUENCY, false);+ auto res_op = coll_array_fields->search("Jeremy", query_fields, "name:= Jeremy Howard", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false});ASSERT_FALSE(res_op.ok());ASSERT_STREQ("To perform exact filtering, filter field `name` must be a facet field.", res_op.error().c_str());// multi match exact query (OR condition)- results = coll_array_fields->search("Jeremy", query_fields, "tags:= [Gold, bronze]", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "tags:= [Gold, bronze]", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(3, results["hits"].size());ASSERT_EQ(3, results["found"].get<size_t>());- results = coll_array_fields->search("Jeremy", query_fields, "tags:= [Gold, bronze, fine PLATINUM]", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "tags:= [Gold, bronze, fine PLATINUM]", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(4, results["hits"].size());ASSERT_EQ(4, results["found"].get<size_t>());// single array multi match- results = coll_array_fields->search("Jeremy", query_fields, "tags:= [fine PLATINUM]", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "tags:= [fine PLATINUM]", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(1, results["hits"].size());ASSERT_EQ(1, results["found"].get<size_t>());@@ -300,11 +300,11 @@ TEST_F(CollectionFilteringTest, FilterOnTextFieldWithColon) {query_fields = {"url"};std::vector<std::string> facets;- auto res = coll1->search("*", query_fields, "url:= https://example.com/1", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ auto res = coll1->search("*", query_fields, "url:= https://example.com/1", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(1, res["hits"].size());ASSERT_STREQ("1", res["hits"][0]["document"]["id"].get<std::string>().c_str());- res = coll1->search("*", query_fields, "url: https://example.com/1", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ res = coll1->search("*", query_fields, "url: https://example.com/1", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(1, res["hits"].size());ASSERT_STREQ("1", res["hits"][0]["document"]["id"].get<std::string>().c_str());@@ -340,27 +340,27 @@ TEST_F(CollectionFilteringTest, HandleBadlyFormedFilterQuery) {std::vector<std::string> facets;// when filter field does not exist in the schema- nlohmann::json results = coll_array_fields->search("Jeremy", query_fields, "tagzz: gold", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ nlohmann::json results = coll_array_fields->search("Jeremy", query_fields, "tagzz: gold", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(0, results["hits"].size());// searching using a string for a numeric field- results = coll_array_fields->search("Jeremy", query_fields, "age: abcdef", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "age: abcdef", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(0, results["hits"].size());// searching using a string for a numeric array field- results = coll_array_fields->search("Jeremy", query_fields, "timestamps: abcdef", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "timestamps: abcdef", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(0, results["hits"].size());// malformed k:v syntax- results = coll_array_fields->search("Jeremy", query_fields, "timestamps abcdef", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "timestamps abcdef", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(0, results["hits"].size());// just spaces - must be treated as empty filter- results = coll_array_fields->search("Jeremy", query_fields, " ", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, " ", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(5, results["hits"].size());// wrapping number with quotes- results = coll_array_fields->search("Jeremy", query_fields, "age: '21'", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "age: '21'", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(0, results["hits"].size());collectionManager.drop_collection("coll_array_fields");@@ -395,7 +395,7 @@ TEST_F(CollectionFilteringTest, FilterAndQueryFieldRestrictions) {// query shall be allowed on faceted text fields as wellquery_fields = {"cast"};Option<nlohmann::json> result_op =- coll_mul_fields->search("anton", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, false);+ coll_mul_fields->search("anton", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false});ASSERT_TRUE(result_op.ok());nlohmann::json results = result_op.get();@@ -406,7 +406,7 @@ TEST_F(CollectionFilteringTest, FilterAndQueryFieldRestrictions) {// filtering on string field should be possiblequery_fields = {"title"};result_op = coll_mul_fields->search("captain", query_fields, "starring: Samuel L. Jackson", facets, sort_fields, {0}, 10, 1,- FREQUENCY, false);+ FREQUENCY, {false});ASSERT_EQ(true, result_op.ok());results = result_op.get();ASSERT_EQ(1, results["hits"].size());@@ -416,60 +416,60 @@ TEST_F(CollectionFilteringTest, FilterAndQueryFieldRestrictions) {// filtering on facet field should be possible (supports partial word search but without typo tolerance)query_fields = {"title"};result_op = coll_mul_fields->search("*", query_fields, "cast: chris", facets, sort_fields, {0}, 10, 1,- FREQUENCY, false);+ FREQUENCY, {false});ASSERT_EQ(true, result_op.ok());results = result_op.get();ASSERT_EQ(3, results["hits"].size());// bad query stringresult_op = coll_mul_fields->search("captain", query_fields, "BLAH", facets, sort_fields, {0}, 10, 1,- FREQUENCY, false);+ FREQUENCY, {false});ASSERT_EQ(false, result_op.ok());ASSERT_STREQ("Could not parse the filter query.", result_op.error().c_str());// missing fieldresult_op = coll_mul_fields->search("captain", query_fields, "age: 100", facets, sort_fields, {0}, 10, 1,- FREQUENCY, false);+ FREQUENCY, {false});ASSERT_EQ(false, result_op.ok());ASSERT_STREQ("Could not find a filter field named `age` in the schema.", result_op.error().c_str());// bad filter value typeresult_op = coll_mul_fields->search("captain", query_fields, "points: \"100\"", facets, sort_fields, {0}, 10, 1,- FREQUENCY, false);+ FREQUENCY, {false});ASSERT_EQ(false, result_op.ok());ASSERT_STREQ("Error with filter field `points`: Numerical field has an invalid comparator.", result_op.error().c_str());// bad filter value type - equaling float on an integer fieldresult_op = coll_mul_fields->search("captain", query_fields, "points: 100.34", facets, sort_fields, {0}, 10, 1,- FREQUENCY, false);+ FREQUENCY, {false});ASSERT_EQ(false, result_op.ok());ASSERT_STREQ("Error with filter field `points`: Not an int32.", result_op.error().c_str());// bad filter value type - less than float on an integer fieldresult_op = coll_mul_fields->search("captain", query_fields, "points: <100.0", facets, sort_fields, {0}, 10, 1,- FREQUENCY, false);+ FREQUENCY, {false});ASSERT_EQ(false, result_op.ok());ASSERT_STREQ("Error with filter field `points`: Not an int32.", result_op.error().c_str());// when an int32 field is queried with a 64-bit numberresult_op = coll_mul_fields->search("captain", query_fields, "points: <2230070399", facets, sort_fields, {0}, 10, 1,- FREQUENCY, false);+ FREQUENCY, {false});ASSERT_EQ(false, result_op.ok());ASSERT_STREQ("Error with filter field `points`: Not an int32.", result_op.error().c_str());// using a string filter value against an integer fieldresult_op = coll_mul_fields->search("captain", query_fields, "points: <sdsdfsdf", facets, sort_fields, {0}, 10, 1,- FREQUENCY, false);+ FREQUENCY, {false});ASSERT_EQ(false, result_op.ok());// large negative numberresult_op = coll_mul_fields->search("captain", query_fields, "points: >-3230070399", facets, sort_fields, {0}, 10, 1,- FREQUENCY, false);+ FREQUENCY, {false});ASSERT_EQ(false, result_op.ok());// but should allow small negative numberresult_op = coll_mul_fields->search("captain", query_fields, "points: >-3230", facets, sort_fields, {0}, 10, 1,- FREQUENCY, false);+ FREQUENCY, {false});ASSERT_EQ(true, result_op.ok());collectionManager.drop_collection("coll_mul_fields");@@ -513,7 +513,7 @@ TEST_F(CollectionFilteringTest, FilterOnNumericFields) {// Plain search with no filters - results should be sorted by rank fieldsquery_fields = {"name"};std::vector<std::string> facets;- nlohmann::json results = coll_array_fields->search("Jeremy", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ nlohmann::json results = coll_array_fields->search("Jeremy", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(5, results["hits"].size());std::vector<std::string> ids = {"3", "1", "4", "0", "2"};@@ -526,7 +526,7 @@ TEST_F(CollectionFilteringTest, FilterOnNumericFields) {}// Searching on an int32 field- results = coll_array_fields->search("Jeremy", query_fields, "age:>24", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "age:>24", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(3, results["hits"].size());ids = {"3", "1", "4"};@@ -538,21 +538,21 @@ TEST_F(CollectionFilteringTest, FilterOnNumericFields) {ASSERT_STREQ(id.c_str(), result_id.c_str());}- results = coll_array_fields->search("Jeremy", query_fields, "age:>=24", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "age:>=24", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(4, results["hits"].size());- results = coll_array_fields->search("Jeremy", query_fields, "age:24", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "age:24", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(1, results["hits"].size());// alternative `:=` syntax- results = coll_array_fields->search("Jeremy", query_fields, "age:=24", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "age:=24", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(1, results["hits"].size());- results = coll_array_fields->search("Jeremy", query_fields, "age:= 24", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "age:= 24", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(1, results["hits"].size());// Searching a number against an int32 array field- results = coll_array_fields->search("Jeremy", query_fields, "years:>2002", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "years:>2002", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(3, results["hits"].size());ids = {"1", "0", "2"};@@ -563,7 +563,7 @@ TEST_F(CollectionFilteringTest, FilterOnNumericFields) {ASSERT_STREQ(id.c_str(), result_id.c_str());}- results = coll_array_fields->search("Jeremy", query_fields, "years:<1989", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "years:<1989", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(1, results["hits"].size());ids = {"3"};@@ -575,7 +575,7 @@ TEST_F(CollectionFilteringTest, FilterOnNumericFields) {}// multiple filters- results = coll_array_fields->search("Jeremy", query_fields, "years:<2005 && years:>1987", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "years:<2005 && years:>1987", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(1, results["hits"].size());ids = {"4"};@@ -587,7 +587,7 @@ TEST_F(CollectionFilteringTest, FilterOnNumericFields) {}// multiple search values (works like SQL's IN operator) against a single int field- results = coll_array_fields->search("Jeremy", query_fields, "age:[21, 24, 63]", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "age:[21, 24, 63]", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(3, results["hits"].size());ids = {"3", "0", "2"};@@ -599,11 +599,11 @@ TEST_F(CollectionFilteringTest, FilterOnNumericFields) {}// alternative `:=` syntax- results = coll_array_fields->search("Jeremy", query_fields, "age:= [21, 24, 63]", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "age:= [21, 24, 63]", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(3, results["hits"].size());// multiple search values against an int32 array field - also use extra padding between symbols- results = coll_array_fields->search("Jeremy", query_fields, "years : [ 2015, 1985 , 1999]", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "years : [ 2015, 1985 , 1999]", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(4, results["hits"].size());ids = {"3", "1", "4", "0"};@@ -615,7 +615,7 @@ TEST_F(CollectionFilteringTest, FilterOnNumericFields) {}// searching on an int64 array field - also ensure that padded space causes no issues- results = coll_array_fields->search("Jeremy", query_fields, "timestamps : > 475205222", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "timestamps : > 475205222", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(4, results["hits"].size());ids = {"1", "4", "0", "2"};@@ -628,7 +628,7 @@ TEST_F(CollectionFilteringTest, FilterOnNumericFields) {}// range based filter- results = coll_array_fields->search("Jeremy", query_fields, "age: 21..32", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "age: 21..32", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(3, results["hits"].size());ids = {"4", "0", "2"};@@ -639,10 +639,10 @@ TEST_F(CollectionFilteringTest, FilterOnNumericFields) {ASSERT_STREQ(id.c_str(), result_id.c_str());}- results = coll_array_fields->search("Jeremy", query_fields, "age: 0 .. 100", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "age: 0 .. 100", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(5, results["hits"].size());- results = coll_array_fields->search("Jeremy", query_fields, "age: [21..24, 40..65]", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "age: [21..24, 40..65]", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(4, results["hits"].size());ids = {"3", "1", "0", "2"};@@ -653,7 +653,7 @@ TEST_F(CollectionFilteringTest, FilterOnNumericFields) {ASSERT_STREQ(id.c_str(), result_id.c_str());}- results = coll_array_fields->search("Jeremy", query_fields, "rating: 7.812 .. 9.999", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "rating: 7.812 .. 9.999", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(2, results["hits"].size());ids = {"1", "2"};@@ -664,11 +664,11 @@ TEST_F(CollectionFilteringTest, FilterOnNumericFields) {ASSERT_STREQ(id.c_str(), result_id.c_str());}- results = coll_array_fields->search("Jeremy", query_fields, "rating: [7.812 .. 9.999, 1.05 .. 1.09]", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "rating: [7.812 .. 9.999, 1.05 .. 1.09]", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(3, results["hits"].size());// when filters don't match any record, no results should be returned- results = coll_array_fields->search("Jeremy", query_fields, "timestamps:>1591091288061", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "timestamps:>1591091288061", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(0, results["hits"].size());collectionManager.drop_collection("coll_array_fields");@@ -704,7 +704,7 @@ TEST_F(CollectionFilteringTest, FilterOnFloatFields) {// Plain search with no filters - results should be sorted by rating field DESCquery_fields = {"name"};std::vector<std::string> facets;- nlohmann::json results = coll_array_fields->search("Jeremy", query_fields, "", facets, sort_fields_desc, {0}, 10, 1, FREQUENCY, false).get();+ nlohmann::json results = coll_array_fields->search("Jeremy", query_fields, "", facets, sort_fields_desc, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(5, results["hits"].size());std::vector<std::string> ids = {"1", "2", "4", "0", "3"};@@ -717,7 +717,7 @@ TEST_F(CollectionFilteringTest, FilterOnFloatFields) {}// Plain search with no filters - results should be sorted by rating field ASC- results = coll_array_fields->search("Jeremy", query_fields, "", facets, sort_fields_asc, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "", facets, sort_fields_asc, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(5, results["hits"].size());ids = {"3", "0", "4", "2", "1"};@@ -730,7 +730,7 @@ TEST_F(CollectionFilteringTest, FilterOnFloatFields) {}// Searching on a float field, sorted desc by rating- results = coll_array_fields->search("Jeremy", query_fields, "rating:>0.0", facets, sort_fields_desc, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "rating:>0.0", facets, sort_fields_desc, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(4, results["hits"].size());ids = {"1", "2", "4", "0"};@@ -743,7 +743,7 @@ TEST_F(CollectionFilteringTest, FilterOnFloatFields) {}// Searching a float against an float array field- results = coll_array_fields->search("Jeremy", query_fields, "top_3:>7.8", facets, sort_fields_desc, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "top_3:>7.8", facets, sort_fields_desc, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(2, results["hits"].size());ids = {"1", "2"};@@ -755,7 +755,7 @@ TEST_F(CollectionFilteringTest, FilterOnFloatFields) {}// multiple filters- results = coll_array_fields->search("Jeremy", query_fields, "top_3:>7.8 && rating:>7.9", facets, sort_fields_desc, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "top_3:>7.8 && rating:>7.9", facets, sort_fields_desc, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(1, results["hits"].size());ids = {"1"};@@ -767,7 +767,7 @@ TEST_F(CollectionFilteringTest, FilterOnFloatFields) {}// multiple search values (works like SQL's IN operator) against a single float field- results = coll_array_fields->search("Jeremy", query_fields, "rating:[1.09, 7.812]", facets, sort_fields_desc, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "rating:[1.09, 7.812]", facets, sort_fields_desc, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(2, results["hits"].size());ids = {"2", "0"};@@ -779,7 +779,7 @@ TEST_F(CollectionFilteringTest, FilterOnFloatFields) {}// multiple search values against a float array field - also use extra padding between symbols- results = coll_array_fields->search("Jeremy", query_fields, "top_3 : [ 5.431, 0.001 , 7.812, 11.992]", facets, sort_fields_desc, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_array_fields->search("Jeremy", query_fields, "top_3 : [ 5.431, 0.001 , 7.812, 11.992]", facets, sort_fields_desc, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(3, results["hits"].size());ids = {"2", "4", "0"};@@ -791,13 +791,13 @@ TEST_F(CollectionFilteringTest, FilterOnFloatFields) {}// when filters don't match any record, no results should be returned- auto results_op = coll_array_fields->search("Jeremy", query_fields, "rating:<-2.78", facets, sort_fields_desc, {0}, 10, 1, FREQUENCY, false);+ auto results_op = coll_array_fields->search("Jeremy", query_fields, "rating:<-2.78", facets, sort_fields_desc, {0}, 10, 1, FREQUENCY, {false});ASSERT_TRUE(results_op.ok());results = results_op.get();ASSERT_EQ(0, results["hits"].size());// rank tokens by default sorting field- results_op = coll_array_fields->search("j", query_fields, "", facets, sort_fields_desc, {0}, 10, 1, MAX_SCORE, true);+ results_op = coll_array_fields->search("j", query_fields, "", facets, sort_fields_desc, {0}, 10, 1, MAX_SCORE, {true});ASSERT_TRUE(results_op.ok());results = results_op.get();ASSERT_EQ(5, results["hits"].size());@@ -846,21 +846,21 @@ TEST_F(CollectionFilteringTest, FilterOnNegativeNumericalFields) {ASSERT_TRUE(coll1->add(doc.dump()).ok());}- auto results = coll1->search("*", {}, "int32_field:<0", {}, {}, {0}, 10, 1, FREQUENCY, true, 10).get();+ auto results = coll1->search("*", {}, "int32_field:<0", {}, {}, {0}, 10, 1, FREQUENCY, {true}, 10).get();ASSERT_EQ(2, results["found"].get<size_t>());ASSERT_EQ(2, results["hits"].size());ASSERT_EQ("0", results["hits"][0]["document"]["id"].get<std::string>());ASSERT_EQ("2", results["hits"][1]["document"]["id"].get<std::string>());- results = coll1->search("*", {}, "int64_field:<0", {}, {}, {0}, 10, 1, FREQUENCY, true, 10).get();+ results = coll1->search("*", {}, "int64_field:<0", {}, {}, {0}, 10, 1, FREQUENCY, {true}, 10).get();ASSERT_EQ(1, results["found"].get<size_t>());ASSERT_EQ(1, results["hits"].size());ASSERT_EQ("1", results["hits"][0]["document"]["id"].get<std::string>());results = coll1->search("*", {}, "float_field:<0", {}, {sort_by("float_field", "desc")}, {0}, 10, 1, FREQUENCY,- true, 10).get();+ {true}, 10).get();ASSERT_EQ(2, results["found"].get<size_t>());ASSERT_EQ(2, results["hits"].size());@@ -900,7 +900,7 @@ TEST_F(CollectionFilteringTest, ComparatorsOnMultiValuedNumericalField) {query_fields = {"name"};std::vector<std::string> facets;nlohmann::json results = coll_array_fields->search("Jeremy", query_fields, "age: [24, >32]",- facets, sort_fields_desc, {0}, 10, 1,FREQUENCY, false).get();+ facets, sort_fields_desc, {0}, 10, 1,FREQUENCY, {false}).get();ASSERT_EQ(3, results["hits"].size());@@ -916,7 +916,7 @@ TEST_F(CollectionFilteringTest, ComparatorsOnMultiValuedNumericalField) {// with <= and >=results = coll_array_fields->search("Jeremy", query_fields, "age: [<=24, >=44]",- facets, sort_fields_desc, {0}, 10, 1,FREQUENCY, false).get();+ facets, sort_fields_desc, {0}, 10, 1,FREQUENCY, {false}).get();ASSERT_EQ(4, results["hits"].size());@@ -1106,7 +1106,7 @@ TEST_F(CollectionFilteringTest, FilteringWithPrefixSearch) {// pick a location close to only the Sacre Coeurauto res_op = coll1->search("e",{"title"}, "points: 23",- {}, {}, {0}, 10, 1, FREQUENCY, true);+ {}, {}, {0}, 10, 1, FREQUENCY, {true});auto results = res_op.get();@@ -1150,7 +1150,7 @@ TEST_F(CollectionFilteringTest, NumericalFilteringWithAnd) {auto results = coll1->search("*",{}, "num_employees:>=100 && num_employees:<=300",- {}, sort_fields, {0}, 10, 1, FREQUENCY, true).get();+ {}, sort_fields, {0}, 10, 1, FREQUENCY, {true}).get();ASSERT_EQ(2, results["found"].get<size_t>());ASSERT_EQ(2, results["hits"].size());@@ -1161,14 +1161,14 @@ TEST_F(CollectionFilteringTest, NumericalFilteringWithAnd) {// when filter number is well below all valuesresults = coll1->search("*",{}, "num_employees:>=100 && num_employees:<=10",- {}, sort_fields, {0}, 10, 1, FREQUENCY, true).get();+ {}, sort_fields, {0}, 10, 1, FREQUENCY, {true}).get();ASSERT_EQ(0, results["found"].get<size_t>());// check boundariesresults = coll1->search("*",{}, "num_employees:>=150 && num_employees:<=250",- {}, sort_fields, {0}, 10, 1, FREQUENCY, true).get();+ {}, sort_fields, {0}, 10, 1, FREQUENCY, {true}).get();ASSERT_EQ(2, results["found"].get<size_t>());ASSERT_STREQ("125", results["hits"][0]["document"]["id"].get<std::string>().c_str());@@ -1176,14 +1176,14 @@ TEST_F(CollectionFilteringTest, NumericalFilteringWithAnd) {results = coll1->search("*",{}, "num_employees:>150 && num_employees:<250",- {}, sort_fields, {0}, 10, 1, FREQUENCY, true).get();+ {}, sort_fields, {0}, 10, 1, FREQUENCY, {true}).get();ASSERT_EQ(0, results["found"].get<size_t>());results = coll1->search("*",{}, "num_employees:>50 && num_employees:<250",- {}, sort_fields, {0}, 10, 1, FREQUENCY, true).get();+ {}, sort_fields, {0}, 10, 1, FREQUENCY, {true}).get();ASSERT_EQ(1, results["found"].get<size_t>());ASSERT_STREQ("125", results["hits"][0]["document"]["id"].get<std::string>().c_str());@@ -1192,7 +1192,7 @@ TEST_F(CollectionFilteringTest, NumericalFilteringWithAnd) {results = coll1->search("*",{}, "num_employees:>50 && num_employees:<=500",- {}, sort_fields, {0}, 10, 1, FREQUENCY, true).get();+ {}, sort_fields, {0}, 10, 1, FREQUENCY, {true}).get();ASSERT_EQ(3, results["found"].get<size_t>());ASSERT_STREQ("125", results["hits"][0]["document"]["id"].get<std::string>().c_str());@@ -1201,7 +1201,7 @@ TEST_F(CollectionFilteringTest, NumericalFilteringWithAnd) {results = coll1->search("*",{}, "num_employees:>=50 && num_employees:<500",- {}, sort_fields, {0}, 10, 1, FREQUENCY, true).get();+ {}, sort_fields, {0}, 10, 1, FREQUENCY, {true}).get();ASSERT_EQ(3, results["found"].get<size_t>());ASSERT_STREQ("123", results["hits"][0]["document"]["id"].get<std::string>().c_str());@@ -1211,7 +1211,7 @@ TEST_F(CollectionFilteringTest, NumericalFilteringWithAnd) {// no matchresults = coll1->search("*",{}, "num_employees:>3000 && num_employees:<10",- {}, sort_fields, {0}, 10, 1, FREQUENCY, true).get();+ {}, sort_fields, {0}, 10, 1, FREQUENCY, {true}).get();ASSERT_EQ(0, results["found"].get<size_t>());@@ -1255,7 +1255,7 @@ TEST_F(CollectionFilteringTest, NumericalFilteringWithArray) {// check equals on a repeating priceauto results = coll1->search("*",{}, "prices:1",- {}, {}, {0}, 10, 1, FREQUENCY, true).get();+ {}, {}, {0}, 10, 1, FREQUENCY, {true}).get();ASSERT_EQ(4, results["found"].get<size_t>());ASSERT_EQ(4, results["hits"].size());@@ -1264,28 +1264,28 @@ TEST_F(CollectionFilteringTest, NumericalFilteringWithArray) {results = coll1->search("*",{}, "prices:>=1",- {}, {}, {0}, 10, 1, FREQUENCY, true).get();+ {}, {}, {0}, 10, 1, FREQUENCY, {true}).get();ASSERT_EQ(4, results["found"].get<size_t>());ASSERT_EQ(4, results["hits"].size());results = coll1->search("*",{}, "prices:>=2",- {}, {}, {0}, 10, 1, FREQUENCY, true).get();+ {}, {}, {0}, 10, 1, FREQUENCY, {true}).get();ASSERT_EQ(3, results["found"].get<size_t>());ASSERT_EQ(3, results["hits"].size());results = coll1->search("*",{}, "prices:<4",- {}, {}, {0}, 10, 1, FREQUENCY, true).get();+ {}, {}, {0}, 10, 1, FREQUENCY, {true}).get();ASSERT_EQ(4, results["found"].get<size_t>());ASSERT_EQ(4, results["hits"].size());results = coll1->search("*",{}, "prices:<=2",- {}, {}, {0}, 10, 1, FREQUENCY, true).get();+ {}, {}, {0}, 10, 1, FREQUENCY, {true}).get();ASSERT_EQ(4, results["found"].get<size_t>());ASSERT_EQ(4, results["hits"].size());@@ -1323,7 +1323,7 @@ TEST_F(CollectionFilteringTest, NegationOperatorBasics) {ASSERT_TRUE(coll1->add(doc.dump()).ok());}- auto results = coll1->search("*", {"artist"}, "artist:- Michael Jackson", {}, {}, {0}, 10, 1, FREQUENCY, true, 10).get();+ auto results = coll1->search("*", {"artist"}, "artist:- Michael Jackson", {}, {}, {0}, 10, 1, FREQUENCY, {true}, 10).get();ASSERT_EQ(3, results["found"].get<size_t>());@@ -1331,14 +1331,14 @@ TEST_F(CollectionFilteringTest, NegationOperatorBasics) {ASSERT_STREQ("2", results["hits"][1]["document"]["id"].get<std::string>().c_str());ASSERT_STREQ("0", results["hits"][2]["document"]["id"].get<std::string>().c_str());- results = coll1->search("*", {"artist"}, "artist:- Michael Jackson && points: >0", {}, {}, {0}, 10, 1, FREQUENCY, true, 10).get();+ results = coll1->search("*", {"artist"}, "artist:- Michael Jackson && points: >0", {}, {}, {0}, 10, 1, FREQUENCY, {true}, 10).get();ASSERT_EQ(2, results["found"].get<size_t>());ASSERT_STREQ("3", results["hits"][0]["document"]["id"].get<std::string>().c_str());ASSERT_STREQ("2", results["hits"][1]["document"]["id"].get<std::string>().c_str());// negation operation on multiple values- results = coll1->search("*", {"artist"}, "artist:- [Michael Jackson, Taylor Swift]", {}, {}, {0}, 10, 1, FREQUENCY, true, 10).get();+ results = coll1->search("*", {"artist"}, "artist:- [Michael Jackson, Taylor Swift]", {}, {}, {0}, 10, 1, FREQUENCY, {true}, 10).get();ASSERT_EQ(1, results["found"].get<size_t>());ASSERT_STREQ("3", results["hits"][0]["document"]["id"].get<std::string>().c_str());@@ -1375,26 +1375,26 @@ TEST_F(CollectionFilteringTest, FilterStringsWithComma) {}auto results = coll1->search("*", {"place"}, "place:= St. John's Cathedral, Denver, Colorado", {}, {}, {0}, 10, 1,- FREQUENCY, true, 10).get();+ FREQUENCY, {true}, 10).get();ASSERT_EQ(1, results["found"].get<size_t>());ASSERT_STREQ("0", results["hits"][0]["document"]["id"].get<std::string>().c_str());results = coll1->search("*", {"place"}, "place:= [`St. John's Cathedral, Denver, Colorado`]", {}, {}, {0}, 10, 1,- FREQUENCY, true, 10).get();+ FREQUENCY, {true}, 10).get();ASSERT_EQ(1, results["found"].get<size_t>());ASSERT_STREQ("0", results["hits"][0]["document"]["id"].get<std::string>().c_str());results = coll1->search("*", {"place"}, "place:= [`St. John's Cathedral, Denver, Colorado`, `St. Patrick's Cathedral, Manhattan`]", {}, {}, {0}, 10, 1,- FREQUENCY, true, 10).get();+ FREQUENCY, {true}, 10).get();ASSERT_EQ(2, results["found"].get<size_t>());ASSERT_STREQ("2", results["hits"][0]["document"]["id"].get<std::string>().c_str());ASSERT_STREQ("0", results["hits"][1]["document"]["id"].get<std::string>().c_str());results = coll1->search("*", {"place"}, "place: [`Cathedral, Denver, Colorado`]", {}, {}, {0}, 10, 1,- FREQUENCY, true, 10).get();+ FREQUENCY, {true}, 10).get();ASSERT_EQ(1, results["found"].get<size_t>());ASSERT_STREQ("0", results["hits"][0]["document"]["id"].get<std::string>().c_str());diff --git a/test/collection_grouping_test.cpp b/test/collection_grouping_test.cppindex 6d84a682..38ea1cda 100644--- a/test/collection_grouping_test.cpp+++ b/test/collection_grouping_test.cpp@@ -62,7 +62,7 @@ protected:TEST_F(CollectionGroupingTest, GroupingBasics) {// group by size (int32)auto res = coll_group->search("*", {}, "", {"brand"}, {}, {0}, 50, 1, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 30, 5,"", 10,@@ -105,7 +105,7 @@ TEST_F(CollectionGroupingTest, GroupingBasics) {// group by rating (float) and sort by sizestd::vector<sort_by> sort_size = {sort_by("size", "DESC")};res = coll_group->search("*", {}, "", {"brand"}, sort_size, {0}, 50, 1, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "brand: omeg", 30, 5,"", 10,@@ -145,7 +145,7 @@ TEST_F(CollectionGroupingTest, GroupingBasics) {TEST_F(CollectionGroupingTest, GroupingCompoundKey) {// group by size+brand (int32, string)auto res = coll_group->search("*", {}, "", {"brand"}, {}, {0}, 50, 1, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 30, 5,"", 10,@@ -192,7 +192,7 @@ TEST_F(CollectionGroupingTest, GroupingCompoundKey) {// pagination with page=2, per_page=2res = coll_group->search("*", {}, "", {"brand"}, {}, {0}, 2, 2, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 30, 5,"", 10,@@ -228,7 +228,7 @@ TEST_F(CollectionGroupingTest, GroupingCompoundKey) {// respect min and max grouping limit (greater than 0 and less than 99)auto res_op = coll_group->search("*", {}, "", {"brand"}, {}, {0}, 50, 1, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "brand: omeg", 30, 5,"", 10,@@ -238,7 +238,7 @@ TEST_F(CollectionGroupingTest, GroupingCompoundKey) {ASSERT_STREQ("Value of `group_limit` must be between 1 and 99.", res_op.error().c_str());res_op = coll_group->search("*", {}, "", {"brand"}, {}, {0}, 50, 1, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "brand: omeg", 30, 5,"", 10,@@ -287,7 +287,7 @@ TEST_F(CollectionGroupingTest, GroupingWithMultiFieldRelevance) {auto results = coll1->search("Dustin Kensrue Down There by the Train",{"title", "artist"}, "", {}, {}, {0}, 10, 1, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 30, 5,"", 10,@@ -315,7 +315,7 @@ TEST_F(CollectionGroupingTest, GroupingWithMultiFieldRelevance) {TEST_F(CollectionGroupingTest, GroupingWithGropLimitOfOne) {auto res = coll_group->search("*", {}, "", {"brand"}, {}, {0}, 50, 1, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 30, 5,"", 10,@@ -389,7 +389,7 @@ TEST_F(CollectionGroupingTest, GroupingWithArrayFieldAndOverride) {ASSERT_TRUE(ov2_op.ok());auto res = coll_group->search("shirt", {"title"}, "", {"brand"}, {}, {0}, 50, 1, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 30, 5,"", 10,diff --git a/test/collection_locale_test.cpp b/test/collection_locale_test.cppindex a2738cfc..e9b0270a 100644--- a/test/collection_locale_test.cpp+++ b/test/collection_locale_test.cpp@@ -58,7 +58,7 @@ TEST_F(CollectionLocaleTest, SearchAgainstJapaneseText) {}auto results = coll1->search("拍治",- {"title"}, "", {}, {}, {0}, 10, 1, FREQUENCY, true).get();+ {"title"}, "", {}, {}, {0}, 10, 1, FREQUENCY, {true}).get();//LOG(INFO) << results;ASSERT_EQ(1, results["found"].get<size_t>());@@ -98,7 +98,7 @@ TEST_F(CollectionLocaleTest, SearchAgainstChineseText) {}auto results = coll1->search("并",- {"title"}, "", {}, {}, {0}, 10, 1, FREQUENCY, true).get();+ {"title"}, "", {}, {}, {0}, 10, 1, FREQUENCY, {true}).get();ASSERT_EQ(1, results["found"].get<size_t>());ASSERT_EQ(1, results["hits"].size());@@ -113,7 +113,7 @@ TEST_F(CollectionLocaleTest, SearchAgainstChineseText) {ASSERT_EQ(0, results["found"].get<size_t>());results = coll1->search("上媽",- {"title", "artist"}, "", {}, {}, {0}, 10, 1, FREQUENCY, true).get();+ {"title", "artist"}, "", {}, {}, {0}, 10, 1, FREQUENCY, {true}).get();ASSERT_EQ(1, results["found"].get<size_t>());ASSERT_EQ(1, results["hits"].size());@@ -123,7 +123,7 @@ TEST_F(CollectionLocaleTest, SearchAgainstChineseText) {// search using simplified chineseresults = coll1->search("妈",- {"title", "artist"}, "", {}, {}, {0}, 10, 1, FREQUENCY, true).get();+ {"title", "artist"}, "", {}, {}, {0}, 10, 1, FREQUENCY, {true}).get();ASSERT_EQ(1, results["found"].get<size_t>());ASSERT_EQ(1, results["hits"].size());@@ -216,10 +216,10 @@ TEST_F(CollectionLocaleTest, SearchThaiTextPreSegmentedQuery) {}auto results = coll1->search("เหลื่",- {"title"}, "", {}, {}, {0}, 10, 1, FREQUENCY, true,+ {"title"}, "", {}, {}, {0}, 10, 1, FREQUENCY, {true},10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 30, 4, "", 40, {}, {}, {}, 0,- "<mark>", "</mark>", {1}, 1000, true, true).get();+ "<mark>", "</mark>", {1}, 1000, true, {true}).get();ASSERT_EQ(1, results["found"].get<size_t>());ASSERT_EQ("0", results["hits"][0]["document"]["id"].get<std::string>());@@ -349,7 +349,7 @@ TEST_F(CollectionLocaleTest, KoreanTextPrefixConsonant) {// To ensure that NFKD works, we will test for both ᄀ (Hangul Choseong Kiyeok)auto results = coll1->search("서울특별시 ᄀ",- {"title"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, true).get();+ {"title"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, {true}).get();ASSERT_EQ(6, results["found"].get<size_t>());ASSERT_EQ(6, results["hits"].size());@@ -357,7 +357,7 @@ TEST_F(CollectionLocaleTest, KoreanTextPrefixConsonant) {// and ㄱ (Hangul Letter Kiyeok)results = coll1->search("서울특별시 ㄱ",- {"title"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, true).get();+ {"title"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, {true}).get();ASSERT_EQ(6, results["found"].get<size_t>());ASSERT_EQ(6, results["hits"].size());@@ -365,7 +365,7 @@ TEST_F(CollectionLocaleTest, KoreanTextPrefixConsonant) {// search for full wordresults = coll1->search("서울특별시 관",- {"title"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, true).get();+ {"title"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, {true}).get();ASSERT_EQ(6, results["found"].get<size_t>());ASSERT_EQ(6, results["hits"].size());@@ -407,7 +407,7 @@ TEST_F(CollectionLocaleTest, KoreanTextPrefixVowel) {std::vector<sort_by> sort_fields = { sort_by(sort_field_const::text_match, "DESC"), sort_by("points", "DESC") };auto results = coll1->search("서울특별시 고",- {"title"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, true).get();+ {"title"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, {true}).get();ASSERT_EQ(6, results["found"].get<size_t>());ASSERT_EQ(6, results["hits"].size());diff --git a/test/collection_manager_test.cpp b/test/collection_manager_test.cppindex de847a90..5ee19b87 100644--- a/test/collection_manager_test.cpp+++ b/test/collection_manager_test.cpp@@ -231,7 +231,7 @@ TEST_F(CollectionManagerTest, RestoreRecordsOnRestart) {std::vector<std::string> search_fields = {"starring", "title"};std::vector<std::string> facets;- nlohmann::json results = collection1->search("thomas", search_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ nlohmann::json results = collection1->search("thomas", search_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();LOG(INFO) << results;ASSERT_EQ(4, results["hits"].size());@@ -283,7 +283,7 @@ TEST_F(CollectionManagerTest, RestoreRecordsOnRestart) {ASSERT_EQ(0, synonyms.at("id3").root.size());ASSERT_EQ(2, synonyms.at("id3").synonyms.size());- results = collection1->search("thomas", search_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = collection1->search("thomas", search_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(4, results["hits"].size());}@@ -372,7 +372,7 @@ TEST_F(CollectionManagerTest, RestoreAutoSchemaDocsOnRestart) {}// try searching for record with bad data- auto results = restored_coll->search("12345", {"title"}, "", {}, {}, {0}, 10, 1, FREQUENCY, false).get();+ auto results = restored_coll->search("12345", {"title"}, "", {}, {}, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(1, results["hits"].size());@@ -388,7 +388,7 @@ TEST_F(CollectionManagerTest, RestoreAutoSchemaDocsOnRestart) {ASSERT_EQ(7, restored_coll->get_num_documents());sort_fields = { sort_by("average", "DESC") };- results = restored_coll->search("*", {"title"}, "", {}, {sort_fields}, {0}, 10, 1, FREQUENCY, false).get();+ results = restored_coll->search("*", {"title"}, "", {}, {sort_fields}, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(7, results["hits"].size());diff --git a/test/collection_override_test.cpp b/test/collection_override_test.cppindex b95c0137..fc40fef4 100644--- a/test/collection_override_test.cpp+++ b/test/collection_override_test.cpp@@ -290,7 +290,7 @@ TEST_F(CollectionOverrideTest, ExcludeIncludeFacetFilterQuery) {coll_mul_fields->add_override(override_include);auto results = coll_mul_fields->search("not-found", {"title"}, "", {"starring"}, {}, {0}, 10, 1, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "starring: will").get();@@ -320,7 +320,7 @@ TEST_F(CollectionOverrideTest, ExcludeIncludeFacetFilterQuery) {coll_mul_fields->add_override(override);results = coll_mul_fields->search("the", {"title"}, "", {"starring"}, {}, {0}, 10, 1, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "starring: scott").get();@@ -336,7 +336,7 @@ TEST_F(CollectionOverrideTest, ExcludeIncludeFacetFilterQuery) {// ensure per_page is respected// first with per_page = 0results = coll_mul_fields->search("the", {"title"}, "", {"starring"}, {}, {0}, 0, 1, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "starring: scott").get();@@ -349,7 +349,7 @@ TEST_F(CollectionOverrideTest, ExcludeIncludeFacetFilterQuery) {coll_mul_fields->add_override(override_include);results = coll_mul_fields->search("not-found", {"title"}, "", {"starring"}, {}, {0}, 1, 1, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "").get();@@ -371,7 +371,7 @@ TEST_F(CollectionOverrideTest, IncludeExcludeHitsQuery) {// basic pinningauto results = coll_mul_fields->search("the", {"title"}, "", {"starring"}, {}, {0}, 50, 1, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "starring: will", 30, 5,"", 10,@@ -388,7 +388,7 @@ TEST_F(CollectionOverrideTest, IncludeExcludeHitsQuery) {std::string hidden_hits="11,16";results = coll_mul_fields->search("the", {"title"}, "", {"starring"}, {}, {0}, 50, 1, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "starring: will", 30, 5,"", 10,@@ -402,7 +402,7 @@ TEST_F(CollectionOverrideTest, IncludeExcludeHitsQuery) {pinned_hits = "13:4,4:5";results = coll_mul_fields->search("the", {"title"}, "", {"starring"}, {}, {0}, 2, 2, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "starring: will", 30, 5,"", 10,@@ -440,7 +440,7 @@ TEST_F(CollectionOverrideTest, IncludeExcludeHitsQuery) {coll_mul_fields->add_override(override_include);results = coll_mul_fields->search("the", {"title"}, "", {"starring"}, {}, {0}, 50, 1, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "starring: will", 30, 5,"", 10,@@ -460,7 +460,7 @@ TEST_F(CollectionOverrideTest, PinnedHitsSmallerThanPageSize) {// 11, 16, 6, 8, 1, 0, 10, 4, 13, 17auto results = coll_mul_fields->search("the", {"title"}, "", {"starring"}, {}, {0}, 8, 1, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "starring: will", 30, 5,"", 10,@@ -478,7 +478,7 @@ TEST_F(CollectionOverrideTest, PinnedHitsSmallerThanPageSize) {std::vector<size_t> expected_ids_p2 = {10, 4};results = coll_mul_fields->search("the", {"title"}, "", {"starring"}, {}, {0}, 8, 2, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "starring: will", 30, 5,"", 10,@@ -498,7 +498,7 @@ TEST_F(CollectionOverrideTest, PinnedHitsLargerThanPageSize) {// pinned hits larger than page size: check that pagination worksauto results = coll_mul_fields->search("the", {"title"}, "", {"starring"}, {}, {0}, 2, 1, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "starring: will", 30, 5,"", 10,@@ -510,7 +510,7 @@ TEST_F(CollectionOverrideTest, PinnedHitsLargerThanPageSize) {ASSERT_STREQ("1", results["hits"][1]["document"]["id"].get<std::string>().c_str());results = coll_mul_fields->search("the", {"title"}, "", {"starring"}, {}, {0}, 2, 2, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "starring: will", 30, 5,"", 10,@@ -522,7 +522,7 @@ TEST_F(CollectionOverrideTest, PinnedHitsLargerThanPageSize) {ASSERT_STREQ("11", results["hits"][1]["document"]["id"].get<std::string>().c_str());results = coll_mul_fields->search("the", {"title"}, "", {"starring"}, {}, {0}, 2, 3, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "starring: will", 30, 5,"", 10,@@ -540,7 +540,7 @@ TEST_F(CollectionOverrideTest, PinnedHitsWhenThereAreNotEnoughResults) {// multiple pinned hits specified, but query produces no resultauto results = coll_mul_fields->search("notfoundquery", {"title"}, "", {"starring"}, {}, {0}, 10, 1, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "starring: will", 30, 5,"", 10,@@ -554,7 +554,7 @@ TEST_F(CollectionOverrideTest, PinnedHitsWhenThereAreNotEnoughResults) {// multiple pinned hits but only single resultresults = coll_mul_fields->search("burgundy", {"title"}, "", {"starring"}, {}, {0}, 10, 1, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "starring: will", 30, 5,"", 10,@@ -596,7 +596,7 @@ TEST_F(CollectionOverrideTest, HiddenHitsHidingSingleResult) {std::string hidden_hits="0";auto results = coll1->search("the train", {"title"}, "", {}, {}, {0}, 50, 1, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 30, 5,"", 10,@@ -606,7 +606,7 @@ TEST_F(CollectionOverrideTest, HiddenHitsHidingSingleResult) {ASSERT_EQ(0, results["hits"].size());results = coll1->search("the train", {"title"}, "points:0", {}, {}, {0}, 50, 1, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 30, 5,"", 10,@@ -625,7 +625,7 @@ TEST_F(CollectionOverrideTest, PinnedHitsGrouping) {// and other IDs should appear in their original positionsauto results = coll_mul_fields->search("the", {"title"}, "", {"starring"}, {}, {0}, 50, 1, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "starring: will", 30, 5,"", 10,@@ -646,7 +646,7 @@ TEST_F(CollectionOverrideTest, PinnedHitsGrouping) {// with groupingresults = coll_mul_fields->search("the", {"title"}, "", {"starring"}, {}, {0}, 50, 1, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "starring: will", 30, 5,"", 10,@@ -698,7 +698,7 @@ TEST_F(CollectionOverrideTest, PinnedHitsWithWildCardQuery) {auto pinned_hits = "7:1,4:2";auto results = coll1->search("*", {"title"}, "", {}, {}, {0}, 30, 11, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 30, 5,"", 10,@@ -744,7 +744,7 @@ TEST_F(CollectionOverrideTest, PinnedHitsIdsHavingColon) {std::string pinned_hits_str = "https://example.com/1:1, https://example.com/3:2"; // can have spaceauto res_op = coll1->search("*", {"url"}, "", {}, {}, {0}, 25, 1, FREQUENCY,- false, Index::DROP_TOKENS_THRESHOLD,+ {false}, Index::DROP_TOKENS_THRESHOLD,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 30, 5,"", 10,diff --git a/test/collection_sorting_test.cpp b/test/collection_sorting_test.cppindex 40a71ba7..63085a1f 100644--- a/test/collection_sorting_test.cpp+++ b/test/collection_sorting_test.cpp@@ -60,7 +60,7 @@ TEST_F(CollectionSortingTest, SortingOrder) {query_fields = {"title"};std::vector<std::string> facets;sort_fields = { sort_by("points", "ASC") };- nlohmann::json results = coll_mul_fields->search("the", query_fields, "", facets, sort_fields, {0}, 15, 1, FREQUENCY, false).get();+ nlohmann::json results = coll_mul_fields->search("the", query_fields, "", facets, sort_fields, {0}, 15, 1, FREQUENCY, {false}).get();ASSERT_EQ(10, results["hits"].size());std::vector<std::string> ids = {"17", "13", "10", "4", "0", "1", "8", "6", "16", "11"};@@ -74,7 +74,7 @@ TEST_F(CollectionSortingTest, SortingOrder) {// limiting results to just 5, "ASC" keyword must be case insensitivesort_fields = { sort_by("points", "asc") };- results = coll_mul_fields->search("the", query_fields, "", facets, sort_fields, {0}, 5, 1, FREQUENCY, false).get();+ results = coll_mul_fields->search("the", query_fields, "", facets, sort_fields, {0}, 5, 1, FREQUENCY, {false}).get();ASSERT_EQ(5, results["hits"].size());ids = {"17", "13", "10", "4", "0"};@@ -89,7 +89,7 @@ TEST_F(CollectionSortingTest, SortingOrder) {// descsort_fields = { sort_by("points", "dEsc") };- results = coll_mul_fields->search("the", query_fields, "", facets, sort_fields, {0}, 15, 1, FREQUENCY, false).get();+ results = coll_mul_fields->search("the", query_fields, "", facets, sort_fields, {0}, 15, 1, FREQUENCY, {false}).get();ASSERT_EQ(10, results["hits"].size());ids = {"11", "16", "6", "8", "1", "0", "10", "4", "13", "17"};@@ -104,7 +104,7 @@ TEST_F(CollectionSortingTest, SortingOrder) {// With empty list of sort_by fields:// should be ordered desc on the default sorting field, since the match score will be the same for all records.sort_fields = { };- results = coll_mul_fields->search("of", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_mul_fields->search("of", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(5, results["hits"].size());ids = {"11", "12", "5", "4", "17"};@@ -163,7 +163,7 @@ TEST_F(CollectionSortingTest, NoDefaultSortingField) {infile.close();// without a default sorting field, matches should be sorted by (text_match, seq_id)- auto results = coll1->search("rocket", {"title"}, "", {}, {}, {1}, 10, 1, FREQUENCY, false).get();+ auto results = coll1->search("rocket", {"title"}, "", {}, {}, {1}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(5, results["found"]);ASSERT_EQ(5, results["hits"].size());@@ -179,7 +179,7 @@ TEST_F(CollectionSortingTest, NoDefaultSortingField) {auto remove_op = coll1->remove("0");ASSERT_TRUE(remove_op.ok());- results = coll1->search("*", {}, "", {}, {}, {1}, 30, 1, FREQUENCY, false).get();+ results = coll1->search("*", {}, "", {}, {}, {1}, 30, 1, FREQUENCY, {false}).get();ASSERT_EQ(23, results["found"]);ASSERT_EQ(23, results["hits"].size());@@ -221,7 +221,7 @@ TEST_F(CollectionSortingTest, FrequencyOrderedTokensWithoutDefaultSortingField)}}- auto results = coll1->search("e", {"title"}, "", {}, {}, {0}, 100, 1, NOT_SET, true).get();+ auto results = coll1->search("e", {"title"}, "", {}, {}, {0}, 100, 1, NOT_SET, {true}).get();// 11 + 10 + 9 + 8 + 7 + 6 + 5 + 4 + 3 + 2ASSERT_EQ(65, results["found"]);@@ -266,7 +266,7 @@ TEST_F(CollectionSortingTest, Int64AsDefaultSortingField) {query_fields = {"title"};std::vector<std::string> facets;sort_fields = { sort_by("points", "ASC") };- nlohmann::json results = coll_mul_fields->search("foo", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ nlohmann::json results = coll_mul_fields->search("foo", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(4, results["hits"].size());std::vector<std::string> ids = {"3", "1", "0", "2"};@@ -280,7 +280,7 @@ TEST_F(CollectionSortingTest, Int64AsDefaultSortingField) {// DESCsort_fields = { sort_by("points", "desc") };- results = coll_mul_fields->search("foo", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_mul_fields->search("foo", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(4, results["hits"].size());ids = {"2", "0", "1", "3"};@@ -320,7 +320,7 @@ TEST_F(CollectionSortingTest, SortOnFloatFields) {query_fields = {"title"};std::vector<std::string> facets;- nlohmann::json results = coll_float_fields->search("Jeremy", query_fields, "", facets, sort_fields_desc, {0}, 10, 1, FREQUENCY, false).get();+ nlohmann::json results = coll_float_fields->search("Jeremy", query_fields, "", facets, sort_fields_desc, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(7, results["hits"].size());std::vector<std::string> ids = {"2", "0", "3", "1", "5", "4", "6"};@@ -333,7 +333,7 @@ TEST_F(CollectionSortingTest, SortOnFloatFields) {}std::vector<sort_by> sort_fields_asc = { sort_by("score", "ASC"), sort_by("average", "ASC") };- results = coll_float_fields->search("Jeremy", query_fields, "", facets, sort_fields_asc, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_float_fields->search("Jeremy", query_fields, "", facets, sort_fields_asc, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(7, results["hits"].size());ids = {"6", "4", "5", "1", "3", "0", "2"};@@ -348,7 +348,7 @@ TEST_F(CollectionSortingTest, SortOnFloatFields) {// second field by descstd::vector<sort_by> sort_fields_asc_desc = { sort_by("score", "ASC"), sort_by("average", "DESC") };- results = coll_float_fields->search("Jeremy", query_fields, "", facets, sort_fields_asc_desc, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_float_fields->search("Jeremy", query_fields, "", facets, sort_fields_asc_desc, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(7, results["hits"].size());ids = {"5", "4", "6", "1", "3", "0", "2"};@@ -397,7 +397,7 @@ TEST_F(CollectionSortingTest, ThreeSortFieldsLimit) {};query_fields = {"title"};- auto res_op = coll1->search("the", query_fields, "", {}, sort_fields_desc, {0}, 10, 1, FREQUENCY, false);+ auto res_op = coll1->search("the", query_fields, "", {}, sort_fields_desc, {0}, 10, 1, FREQUENCY, {false});ASSERT_FALSE(res_op.ok());ASSERT_STREQ("Only upto 3 sort_by fields can be specified.", res_op.error().c_str());@@ -479,7 +479,7 @@ TEST_F(CollectionSortingTest, SingleFieldTextMatchScoreDefault) {auto results = coll1->search("alpha",{"title"}, "", {}, sort_fields, {2}, 10, 1, FREQUENCY,- false, 10).get();+ {false}, 10).get();ASSERT_EQ(3, results["found"].get<size_t>());ASSERT_EQ(3, results["hits"].size());@@ -517,7 +517,7 @@ TEST_F(CollectionSortingTest, NegativeInt64Value) {query_fields = {"title"};auto res = coll1->search("*", query_fields, "points:>=1577836800", {}, sort_fields_desc, {0}, 10, 1, FREQUENCY,- false).get();+ {false}).get();ASSERT_EQ(0, res["found"].get<size_t>());diff --git a/test/collection_synonyms_test.cpp b/test/collection_synonyms_test.cppindex 2b203b50..15f040c1 100644--- a/test/collection_synonyms_test.cpp+++ b/test/collection_synonyms_test.cpp@@ -350,7 +350,7 @@ TEST_F(CollectionSynonymsTest, MultiWaySynonym) {syn_op = synonym_t::parse(syn_json2, synonym2);ASSERT_TRUE(syn_op.ok());- res = coll_mul_fields->search("samuel leroy jackson", {"starring"}, "", {}, {}, {0}, 10, 1, FREQUENCY, false, 0).get();+ res = coll_mul_fields->search("samuel leroy jackson", {"starring"}, "", {}, {}, {0}, 10, 1, FREQUENCY, {false}, 0).get();ASSERT_EQ(0, res["hits"].size());coll_mul_fields->add_synonym(synonym2);@@ -364,7 +364,7 @@ TEST_F(CollectionSynonymsTest, MultiWaySynonym) {// for now we don't support synonyms on ANY prefix- res = coll_mul_fields->search("ler", {"starring"}, "", {}, {}, {0}, 10, 1, FREQUENCY, true).get();+ res = coll_mul_fields->search("ler", {"starring"}, "", {}, {}, {0}, 10, 1, FREQUENCY, {true}).get();ASSERT_EQ(0, res["hits"].size());ASSERT_EQ(0, res["found"].get<uint32_t>());}@@ -410,7 +410,7 @@ TEST_F(CollectionSynonymsTest, ExactMatchRankedSameAsSynonymMatch) {coll1->add_synonym(synonym);- auto res = coll1->search("laughing", {"title"}, "", {}, {}, {0}, 10, 1, FREQUENCY, false, 0).get();+ auto res = coll1->search("laughing", {"title"}, "", {}, {}, {0}, 10, 1, FREQUENCY, {false}, 0).get();ASSERT_EQ(4, res["hits"].size());ASSERT_EQ(4, res["found"].get<uint32_t>());@@ -464,7 +464,7 @@ TEST_F(CollectionSynonymsTest, SynonymFieldOrdering) {coll1->add_synonym(synonym);- auto res = coll1->search("laughing", {"title", "description"}, "", {}, {}, {0}, 10, 1, FREQUENCY, false, 0).get();+ auto res = coll1->search("laughing", {"title", "description"}, "", {}, {}, {0}, 10, 1, FREQUENCY, {false}, 0).get();ASSERT_EQ(2, res["hits"].size());ASSERT_EQ(2, res["found"].get<uint32_t>());diff --git a/test/collection_test.cpp b/test/collection_test.cppindex 9e5178cb..fb87efab 100644--- a/test/collection_test.cpp+++ b/test/collection_test.cpp@@ -276,11 +276,11 @@ TEST_F(CollectionTest, SkipUnindexedTokensDuringPhraseSearch) {// should not try to drop tokens to expand queryresults.clear();- results = collection->search("the a", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, false, 10).get();+ results = collection->search("the a", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}, 10).get();ASSERT_EQ(9, results["hits"].size());results.clear();- results = collection->search("the a", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, false, 0).get();+ results = collection->search("the a", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}, 0).get();ASSERT_EQ(3, results["hits"].size());ids = {"8", "16", "10"};@@ -292,7 +292,7 @@ TEST_F(CollectionTest, SkipUnindexedTokensDuringPhraseSearch) {}results.clear();- results = collection->search("the a DoesNotExist", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, false, 0).get();+ results = collection->search("the a DoesNotExist", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}, 0).get();ASSERT_EQ(0, results["hits"].size());// with no indexed word@@ -350,7 +350,7 @@ TEST_F(CollectionTest, QueryWithTypo) {TEST_F(CollectionTest, TypoTokenRankedByScoreAndFrequency) {std::vector<std::string> facets;- nlohmann::json results = collection->search("loox", query_fields, "", facets, sort_fields, {1}, 2, 1, MAX_SCORE, false).get();+ nlohmann::json results = collection->search("loox", query_fields, "", facets, sort_fields, {1}, 2, 1, MAX_SCORE, {false}).get();ASSERT_EQ(2, results["hits"].size());std::vector<std::string> ids = {"22", "3"};@@ -361,7 +361,7 @@ TEST_F(CollectionTest, TypoTokenRankedByScoreAndFrequency) {ASSERT_STREQ(id.c_str(), result_id.c_str());}- results = collection->search("loox", query_fields, "", facets, sort_fields, {1}, 3, 1, FREQUENCY, false).get();+ results = collection->search("loox", query_fields, "", facets, sort_fields, {1}, 3, 1, FREQUENCY, {false}).get();ASSERT_EQ(3, results["hits"].size());ids = {"22", "3", "12"};@@ -373,19 +373,19 @@ TEST_F(CollectionTest, TypoTokenRankedByScoreAndFrequency) {}// Check pagination- results = collection->search("loox", query_fields, "", facets, sort_fields, {1}, 1, 1, FREQUENCY, false).get();+ results = collection->search("loox", query_fields, "", facets, sort_fields, {1}, 1, 1, FREQUENCY, {false}).get();ASSERT_EQ(5, results["found"].get<int>());ASSERT_EQ(1, results["hits"].size());std::string solo_id = results["hits"].at(0)["document"]["id"];ASSERT_STREQ("22", solo_id.c_str());- results = collection->search("loox", query_fields, "", facets, sort_fields, {1}, 2, 1, FREQUENCY, false).get();+ results = collection->search("loox", query_fields, "", facets, sort_fields, {1}, 2, 1, FREQUENCY, {false}).get();ASSERT_EQ(5, results["found"].get<int>());ASSERT_EQ(2, results["hits"].size());// Check total ordering- results = collection->search("loox", query_fields, "", facets, sort_fields, {1}, 10, 1, FREQUENCY, false).get();+ results = collection->search("loox", query_fields, "", facets, sort_fields, {1}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(5, results["hits"].size());ids = {"22", "3", "12", "23", "24"};@@ -396,7 +396,7 @@ TEST_F(CollectionTest, TypoTokenRankedByScoreAndFrequency) {ASSERT_STREQ(id.c_str(), result_id.c_str());}- results = collection->search("loox", query_fields, "", facets, sort_fields, {1}, 10, 1, MAX_SCORE, false).get();+ results = collection->search("loox", query_fields, "", facets, sort_fields, {1}, 10, 1, MAX_SCORE, {false}).get();ASSERT_EQ(5, results["hits"].size());ids = {"22", "3", "12", "23", "24"};@@ -411,7 +411,7 @@ TEST_F(CollectionTest, TypoTokenRankedByScoreAndFrequency) {TEST_F(CollectionTest, TextContainingAnActualTypo) {// A line contains "ISX" but not "what" - need to ensure that correction to "ISS what" happensstd::vector<std::string> facets;- nlohmann::json results = collection->search("ISX what", query_fields, "", facets, sort_fields, {1}, 4, 1, FREQUENCY, false).get();+ nlohmann::json results = collection->search("ISX what", query_fields, "", facets, sort_fields, {1}, 4, 1, FREQUENCY, {false}).get();ASSERT_EQ(4, results["hits"].size());ASSERT_EQ(13, results["found"].get<uint32_t>());@@ -425,7 +425,7 @@ TEST_F(CollectionTest, TextContainingAnActualTypo) {}// Record containing exact token match should appear first- results = collection->search("ISX", query_fields, "", facets, sort_fields, {1}, 10, 1, FREQUENCY, false).get();+ results = collection->search("ISX", query_fields, "", facets, sort_fields, {1}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(8, results["hits"].size());ASSERT_EQ(8, results["found"].get<uint32_t>());@@ -440,7 +440,7 @@ TEST_F(CollectionTest, TextContainingAnActualTypo) {}TEST_F(CollectionTest, Pagination) {- nlohmann::json results = collection->search("the", query_fields, "", {}, sort_fields, {0}, 3, 1, FREQUENCY, false).get();+ nlohmann::json results = collection->search("the", query_fields, "", {}, sort_fields, {0}, 3, 1, FREQUENCY, {false}).get();ASSERT_EQ(3, results["hits"].size());ASSERT_EQ(7, results["found"].get<uint32_t>());@@ -453,7 +453,7 @@ TEST_F(CollectionTest, Pagination) {ASSERT_STREQ(id.c_str(), result_id.c_str());}- results = collection->search("the", query_fields, "", {}, sort_fields, {0}, 3, 2, FREQUENCY, false).get();+ results = collection->search("the", query_fields, "", {}, sort_fields, {0}, 3, 2, FREQUENCY, {false}).get();ASSERT_EQ(3, results["hits"].size());ASSERT_EQ(7, results["found"].get<uint32_t>());@@ -466,7 +466,7 @@ TEST_F(CollectionTest, Pagination) {ASSERT_STREQ(id.c_str(), result_id.c_str());}- results = collection->search("the", query_fields, "", {}, sort_fields, {0}, 3, 3, FREQUENCY, false).get();+ results = collection->search("the", query_fields, "", {}, sort_fields, {0}, 3, 3, FREQUENCY, {false}).get();ASSERT_EQ(1, results["hits"].size());ASSERT_EQ(7, results["found"].get<uint32_t>());@@ -482,14 +482,14 @@ TEST_F(CollectionTest, Pagination) {TEST_F(CollectionTest, WildcardQuery) {nlohmann::json results = collection->search("*", query_fields, "points:>0", {}, sort_fields, {0}, 3, 1, FREQUENCY,- false).get();+ {false}).get();ASSERT_EQ(3, results["hits"].size());ASSERT_EQ(25, results["found"].get<uint32_t>());// when no filter is specified, fall back on default sorting field based catch-all filterOption<nlohmann::json> results_op = collection->search("*", query_fields, "", {}, sort_fields, {0}, 3, 1, FREQUENCY,- false);+ {false});ASSERT_TRUE(results_op.ok());ASSERT_EQ(3, results["hits"].size());@@ -497,7 +497,7 @@ TEST_F(CollectionTest, WildcardQuery) {// wildcard query with no filters and ASC sortstd::vector<sort_by> sort_fields = { sort_by("points", "ASC") };- results = collection->search("*", query_fields, "", {}, sort_fields, {0}, 3, 1, FREQUENCY, false).get();+ results = collection->search("*", query_fields, "", {}, sort_fields, {0}, 3, 1, FREQUENCY, {false}).get();ASSERT_EQ(3, results["hits"].size());ASSERT_EQ(25, results["found"].get<uint32_t>());@@ -511,21 +511,21 @@ TEST_F(CollectionTest, WildcardQuery) {}// wildcard query should not require a search field- results_op = collection->search("*", {}, "", {}, sort_fields, {0}, 3, 1, FREQUENCY, false);+ results_op = collection->search("*", {}, "", {}, sort_fields, {0}, 3, 1, FREQUENCY, {false});ASSERT_TRUE(results_op.ok());results = results_op.get();ASSERT_EQ(3, results["hits"].size());ASSERT_EQ(25, results["found"].get<uint32_t>());// non-wildcard query should require a search field- results_op = collection->search("the", {}, "", {}, sort_fields, {0}, 3, 1, FREQUENCY, false);+ results_op = collection->search("the", {}, "", {}, sort_fields, {0}, 3, 1, FREQUENCY, {false});ASSERT_FALSE(results_op.ok());ASSERT_STREQ("No search fields specified for the query.", results_op.error().c_str());}TEST_F(CollectionTest, PrefixSearching) {std::vector<std::string> facets;- nlohmann::json results = collection->search("ex", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, true).get();+ nlohmann::json results = collection->search("ex", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, {true}).get();ASSERT_EQ(2, results["hits"].size());std::vector<std::string> ids = {"6", "12"};@@ -536,7 +536,7 @@ TEST_F(CollectionTest, PrefixSearching) {ASSERT_STREQ(id.c_str(), result_id.c_str());}- results = collection->search("ex", query_fields, "", facets, sort_fields, {0}, 10, 1, MAX_SCORE, true).get();+ results = collection->search("ex", query_fields, "", facets, sort_fields, {0}, 10, 1, MAX_SCORE, {true}).get();ASSERT_EQ(2, results["hits"].size());ids = {"6", "12"};@@ -547,7 +547,7 @@ TEST_F(CollectionTest, PrefixSearching) {ASSERT_STREQ(id.c_str(), result_id.c_str());}- results = collection->search("what ex", query_fields, "", facets, sort_fields, {0}, 10, 1, MAX_SCORE, true).get();+ results = collection->search("what ex", query_fields, "", facets, sort_fields, {0}, 10, 1, MAX_SCORE, {true}).get();ASSERT_EQ(9, results["hits"].size());ids = {"6", "12", "19", "22", "13", "8", "15", "24", "21"};@@ -559,7 +559,7 @@ TEST_F(CollectionTest, PrefixSearching) {}// restrict to only 2 results and differentiate between MAX_SCORE and FREQUENCY- results = collection->search("t", query_fields, "", facets, sort_fields, {0}, 2, 1, MAX_SCORE, true).get();+ results = collection->search("t", query_fields, "", facets, sort_fields, {0}, 2, 1, MAX_SCORE, {true}).get();ASSERT_EQ(2, results["hits"].size());ids = {"19", "22"};@@ -570,7 +570,7 @@ TEST_F(CollectionTest, PrefixSearching) {ASSERT_STREQ(id.c_str(), result_id.c_str());}- results = collection->search("t", query_fields, "", facets, sort_fields, {0}, 2, 1, FREQUENCY, true).get();+ results = collection->search("t", query_fields, "", facets, sort_fields, {0}, 2, 1, FREQUENCY, {true}).get();ASSERT_EQ(2, results["hits"].size());ids = {"19", "22"};@@ -582,15 +582,15 @@ TEST_F(CollectionTest, PrefixSearching) {}// only the last token in the query should be used for prefix search - so, "math" should not match "mathematics"- results = collection->search("math fx", query_fields, "", facets, sort_fields, {0}, 1, 1, FREQUENCY, true).get();+ results = collection->search("math fx", query_fields, "", facets, sort_fields, {0}, 1, 1, FREQUENCY, {true}).get();ASSERT_EQ(0, results["hits"].size());// single and double char prefixes should set a ceiling on the num_typos possible- results = collection->search("x", query_fields, "", facets, sort_fields, {2}, 2, 1, FREQUENCY, true).get();+ results = collection->search("x", query_fields, "", facets, sort_fields, {2}, 2, 1, FREQUENCY, {true}).get();ASSERT_EQ(0, results["hits"].size());// prefix with a typo- results = collection->search("late propx", query_fields, "", facets, sort_fields, {2}, 1, 1, FREQUENCY, true).get();+ results = collection->search("late propx", query_fields, "", facets, sort_fields, {2}, 1, 1, FREQUENCY, {true}).get();ASSERT_EQ(1, results["hits"].size());ASSERT_EQ("16", results["hits"].at(0)["document"]["id"]);}@@ -598,14 +598,14 @@ TEST_F(CollectionTest, PrefixSearching) {TEST_F(CollectionTest, TypoTokensThreshold) {// Query expansion should happen only based on the `typo_tokens_threshold` valueauto results = collection->search("launch", {"title"}, "", {}, sort_fields, {2}, 10, 1,- token_ordering::FREQUENCY, true, 10, spp::sparse_hash_set<std::string>(),+ token_ordering::FREQUENCY, {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 5, 5, "", 0).get();ASSERT_EQ(5, results["hits"].size());ASSERT_EQ(5, results["found"].get<size_t>());results = collection->search("launch", {"title"}, "", {}, sort_fields, {2}, 10, 1,- token_ordering::FREQUENCY, true, 10, spp::sparse_hash_set<std::string>(),+ token_ordering::FREQUENCY, {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 5, 5, "", 10).get();ASSERT_EQ(7, results["hits"].size());@@ -633,7 +633,7 @@ TEST_F(CollectionTest, MultiOccurrenceString) {query_fields = {"title"};nlohmann::json results = coll_multi_string->search("the", query_fields, "", {}, sort_fields, {0}, 10, 1,- FREQUENCY, false, 0).get();+ FREQUENCY, {false}, 0).get();ASSERT_EQ(1, results["hits"].size());collectionManager.drop_collection("coll_multi_string");}@@ -665,7 +665,7 @@ TEST_F(CollectionTest, ArrayStringFieldHighlight) {std::vector<std::string> facets;nlohmann::json results = coll_array_text->search("truth about", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY,- false, 0).get();+ {false}, 0).get();ASSERT_EQ(1, results["hits"].size());std::vector<std::string> ids = {"0"};@@ -692,7 +692,7 @@ TEST_F(CollectionTest, ArrayStringFieldHighlight) {ASSERT_EQ(1, results["hits"][0]["highlights"][0]["indices"][2]);results = coll_array_text->search("forever truth", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY,- false, 0).get();+ {false}, 0).get();ASSERT_EQ(1, results["hits"].size());ids = {"0"};@@ -715,7 +715,7 @@ TEST_F(CollectionTest, ArrayStringFieldHighlight) {ASSERT_EQ(2, results["hits"][0]["highlights"][0]["indices"][2]);results = coll_array_text->search("truth", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY,- false, 0).get();+ {false}, 0).get();ASSERT_EQ(2, results["hits"].size());ids = {"1", "0"};@@ -728,12 +728,12 @@ TEST_F(CollectionTest, ArrayStringFieldHighlight) {}results = coll_array_text->search("asdadasd", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY,- false, 0).get();+ {false}, 0).get();ASSERT_EQ(0, results["hits"].size());query_fields = {"title", "tags"};results = coll_array_text->search("truth", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY,- false, 0).get();+ {false}, 0).get();ASSERT_EQ(2, results["hits"].size());ASSERT_EQ(2, results["hits"][0]["highlights"].size());@@ -786,7 +786,7 @@ TEST_F(CollectionTest, ArrayStringFieldHighlight) {// highlight fields must be ordered based on match scoreresults = coll_array_text->search("amazing movie", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY,- false, 0).get();+ {false}, 0).get();ASSERT_EQ(1, results["hits"].size());ASSERT_EQ(2, results["hits"][0]["highlights"].size());@@ -809,7 +809,7 @@ TEST_F(CollectionTest, ArrayStringFieldHighlight) {// when query tokens are not found in an array field they should be ignoredresults = coll_array_text->search("winds", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY,- false, 0).get();+ {false}, 0).get();ASSERT_EQ(1, results["hits"].size());ASSERT_EQ(1, results["hits"][0]["highlights"].size());@@ -844,7 +844,7 @@ TEST_F(CollectionTest, MultipleFields) {query_fields = {"title", "starring"};std::vector<std::string> facets;- nlohmann::json results = coll_mul_fields->search("Will", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ nlohmann::json results = coll_mul_fields->search("Will", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(4, results["hits"].size());std::vector<std::string> ids = {"3", "2", "1", "0"};@@ -859,7 +859,7 @@ TEST_F(CollectionTest, MultipleFields) {// when "starring" takes higher priority than "title"query_fields = {"starring", "title"};- results = coll_mul_fields->search("thomas", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_mul_fields->search("thomas", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(4, results["hits"].size());ids = {"15", "12", "13", "14"};@@ -872,11 +872,11 @@ TEST_F(CollectionTest, MultipleFields) {}query_fields = {"starring", "title", "cast"};- results = coll_mul_fields->search("ben affleck", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_mul_fields->search("ben affleck", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(1, results["hits"].size());query_fields = {"cast"};- results = coll_mul_fields->search("chris", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_mul_fields->search("chris", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(3, results["hits"].size());ids = {"6", "1", "7"};@@ -888,7 +888,7 @@ TEST_F(CollectionTest, MultipleFields) {}query_fields = {"cast"};- results = coll_mul_fields->search("chris pine", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_mul_fields->search("chris pine", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(3, results["hits"].size());ids = {"7", "6", "1"};@@ -901,7 +901,7 @@ TEST_F(CollectionTest, MultipleFields) {// filtering on unfaceted multi-valued string fieldquery_fields = {"title"};- results = coll_mul_fields->search("captain", query_fields, "cast: chris", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_mul_fields->search("captain", query_fields, "cast: chris", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(1, results["hits"].size());ids = {"6"};for(size_t i = 0; i < results["hits"].size(); i++) {@@ -915,7 +915,7 @@ TEST_F(CollectionTest, MultipleFields) {query_fields = {"starring", "title", "cast"};facets = {"starring_facet"};- results = coll_mul_fields->search("myers", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_mul_fields->search("myers", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(1, results["hits"].size());ids = {"17"};for(size_t i = 0; i < results["hits"].size(); i++) {@@ -963,21 +963,21 @@ TEST_F(CollectionTest, KeywordQueryReturnsResultsBasedOnPerPageParam) {spp::sparse_hash_set<std::string> empty;nlohmann::json results = coll_mul_fields->search("w", query_fields, "", facets, sort_fields, {0}, 3, 1,- FREQUENCY, true, 1000, empty, empty, 10).get();+ FREQUENCY, {true}, 1000, empty, empty, 10).get();ASSERT_EQ(3, results["hits"].size());ASSERT_EQ(7, results["found"].get<int>());// cannot fetch more than in-built limit of 250auto res_op = coll_mul_fields->search("w", query_fields, "", facets, sort_fields, {0}, 251, 1,- FREQUENCY, true, 1000, empty, empty, 10);+ FREQUENCY, {true}, 1000, empty, empty, 10);ASSERT_FALSE(res_op.ok());ASSERT_EQ(422, res_op.code());ASSERT_STREQ("Only upto 250 hits can be fetched per page.", res_op.error().c_str());// when page number is not validres_op = coll_mul_fields->search("w", query_fields, "", facets, sort_fields, {0}, 10, 0,- FREQUENCY, true, 1000, empty, empty, 10);+ FREQUENCY, {true}, 1000, empty, empty, 10);ASSERT_FALSE(res_op.ok());ASSERT_EQ(422, res_op.code());ASSERT_STREQ("Page must be an integer of value greater than 0.", res_op.error().c_str());@@ -985,19 +985,19 @@ TEST_F(CollectionTest, KeywordQueryReturnsResultsBasedOnPerPageParam) {// do paginationresults = coll_mul_fields->search("w", query_fields, "", facets, sort_fields, {0}, 3, 1,- FREQUENCY, true, 1000, empty, empty, 10).get();+ FREQUENCY, {true}, 1000, empty, empty, 10).get();ASSERT_EQ(3, results["hits"].size());ASSERT_EQ(7, results["found"].get<int>());results = coll_mul_fields->search("w", query_fields, "", facets, sort_fields, {0}, 3, 2,- FREQUENCY, true, 1000, empty, empty, 10).get();+ FREQUENCY, {true}, 1000, empty, empty, 10).get();ASSERT_EQ(3, results["hits"].size());ASSERT_EQ(7, results["found"].get<int>());results = coll_mul_fields->search("w", query_fields, "", facets, sort_fields, {0}, 3, 3,- FREQUENCY, true, 1000, empty, empty, 10).get();+ FREQUENCY, {true}, 1000, empty, empty, 10).get();ASSERT_EQ(1, results["hits"].size());ASSERT_EQ(7, results["found"].get<int>());@@ -1045,7 +1045,7 @@ TEST_F(CollectionTest, ImportDocumentsUpsert) {ASSERT_EQ(18, import_response["num_imported"].get<int>());// try searching with filter- auto results = coll_mul_fields->search("*", query_fields, "starring:= [Will Ferrell]", {"starring"}, sort_fields, {0}, 30, 1, FREQUENCY, false).get();+ auto results = coll_mul_fields->search("*", query_fields, "starring:= [Will Ferrell]", {"starring"}, sort_fields, {0}, 30, 1, FREQUENCY, {false}).get();ASSERT_EQ(2, results["hits"].size());// update existing record verbatim@@ -1074,32 +1074,32 @@ TEST_F(CollectionTest, ImportDocumentsUpsert) {}// try with filters again- results = coll_mul_fields->search("*", query_fields, "starring:= [Will Ferrell]", {"starring"}, sort_fields, {0}, 30, 1, FREQUENCY, false).get();+ results = coll_mul_fields->search("*", query_fields, "starring:= [Will Ferrell]", {"starring"}, sort_fields, {0}, 30, 1, FREQUENCY, {false}).get();ASSERT_EQ(2, results["hits"].size());- results = coll_mul_fields->search("*", query_fields, "", {"starring"}, sort_fields, {0}, 30, 1, FREQUENCY, false).get();+ results = coll_mul_fields->search("*", query_fields, "", {"starring"}, sort_fields, {0}, 30, 1, FREQUENCY, {false}).get();ASSERT_EQ(19, results["hits"].size());ASSERT_EQ(19, coll_mul_fields->get_num_documents());- results = coll_mul_fields->search("back again forest", query_fields, "", {"starring"}, sort_fields, {0}, 30, 1, FREQUENCY, false).get();+ results = coll_mul_fields->search("back again forest", query_fields, "", {"starring"}, sort_fields, {0}, 30, 1, FREQUENCY, {false}).get();ASSERT_EQ(1, results["hits"].size());ASSERT_STREQ("Back Again Forest", coll_mul_fields->get("18").get()["title"].get<std::string>().c_str());- results = coll_mul_fields->search("fifth", query_fields, "", {"starring"}, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_mul_fields->search("fifth", query_fields, "", {"starring"}, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(2, results["hits"].size());ASSERT_STREQ("The <mark>Fifth</mark> Harry", results["hits"][0]["highlights"][0]["snippet"].get<std::string>().c_str());ASSERT_STREQ("The Woman in the <mark>Fifth</mark> from Kristin", results["hits"][1]["highlights"][0]["snippet"].get<std::string>().c_str());- results = coll_mul_fields->search("burgundy", query_fields, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_mul_fields->search("burgundy", query_fields, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(0, results["hits"].size());- results = coll_mul_fields->search("harry", query_fields, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_mul_fields->search("harry", query_fields, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(1, results["hits"].size());- results = coll_mul_fields->search("captain america", query_fields, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_mul_fields->search("captain america", query_fields, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(1, results["hits"].size());ASSERT_EQ(77, results["hits"][0]["document"]["points"].get<size_t>());@@ -1144,7 +1144,7 @@ TEST_F(CollectionTest, ImportDocumentsUpsert) {ASSERT_TRUE(import_response["success"].get<bool>());ASSERT_EQ(1, import_response["num_imported"].get<int>());- results = coll_mul_fields->search("Good Will Hunting", query_fields, "", {"starring"}, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_mul_fields->search("Good Will Hunting", query_fields, "", {"starring"}, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(70, results["hits"][0]["document"]["points"].get<uint32_t>());// updating a document that does not exist should fail, others should succeed@@ -1161,7 +1161,7 @@ TEST_F(CollectionTest, ImportDocumentsUpsert) {ASSERT_STREQ("Could not find a document with id: 20", import_results[0]["error"].get<std::string>().c_str());ASSERT_EQ(404, import_results[0]["code"].get<size_t>());- results = coll_mul_fields->search("wake up harry", query_fields, "", {"starring"}, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_mul_fields->search("wake up harry", query_fields, "", {"starring"}, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(64, results["hits"][0]["document"]["points"].get<uint32_t>());// trying to create documents with existing IDs should fail@@ -1300,9 +1300,9 @@ TEST_F(CollectionTest, ImportDocuments) {query_fields = {"title", "starring"};std::vector<std::string> facets;- auto x = coll_mul_fields->search("Will", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, false);+ auto x = coll_mul_fields->search("Will", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false});- nlohmann::json results = coll_mul_fields->search("Will", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ nlohmann::json results = coll_mul_fields->search("Will", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(4, results["hits"].size());std::vector<std::string> ids = {"3", "2", "1", "0"};@@ -1433,7 +1433,7 @@ TEST_F(CollectionTest, QueryBoolFields) {// Plain search with no filters - results should be sorted correctlyquery_fields = {"title"};std::vector<std::string> facets;- nlohmann::json results = coll_bool->search("the", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ nlohmann::json results = coll_bool->search("the", query_fields, "", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(5, results["hits"].size());std::vector<std::string> ids = {"1", "3", "4", "9", "2"};@@ -1446,7 +1446,7 @@ TEST_F(CollectionTest, QueryBoolFields) {}// Searching on a bool field- results = coll_bool->search("the", query_fields, "popular:true", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_bool->search("the", query_fields, "popular:true", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(3, results["hits"].size());ids = {"1", "3", "4"};@@ -1459,10 +1459,10 @@ TEST_F(CollectionTest, QueryBoolFields) {}// alternative `:=` syntax- results = coll_bool->search("the", query_fields, "popular:=true", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_bool->search("the", query_fields, "popular:=true", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(3, results["hits"].size());- results = coll_bool->search("the", query_fields, "popular:false", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_bool->search("the", query_fields, "popular:false", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(2, results["hits"].size());ids = {"9", "2"};@@ -1478,13 +1478,13 @@ TEST_F(CollectionTest, QueryBoolFields) {// should be able to filter with an array of boolean valuesOption<nlohmann::json> res_op = coll_bool->search("the", query_fields, "bool_array:[true, false]", facets,- sort_fields, {0}, 10, 1, FREQUENCY, false);+ sort_fields, {0}, 10, 1, FREQUENCY, {false});ASSERT_TRUE(res_op.ok());results = res_op.get();ASSERT_EQ(5, results["hits"].size());- results = coll_bool->search("the", query_fields, "bool_array: true", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_bool->search("the", query_fields, "bool_array: true", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(4, results["hits"].size());ids = {"1", "4", "9", "2"};@@ -1498,9 +1498,9 @@ TEST_F(CollectionTest, QueryBoolFields) {// should be able to search using array with a single element boolean valueauto res = coll_bool->search("the", query_fields, "bool_array:[true]", facets,- sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();- results = coll_bool->search("the", query_fields, "bool_array: true", facets, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ results = coll_bool->search("the", query_fields, "bool_array: true", facets, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(4, results["hits"].size());for(size_t i = 0; i < results["hits"].size(); i++) {@@ -1680,7 +1680,7 @@ TEST_F(CollectionTest, EmptyIndexShouldNotCrash) {empty_coll = collectionManager.create_collection("empty_coll", 4, fields, "age").get();}- nlohmann::json results = empty_coll->search("a", {"name"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, false).get();+ nlohmann::json results = empty_coll->search("a", {"name"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(0, results["hits"].size());collectionManager.drop_collection("empty_coll");}@@ -1775,7 +1775,7 @@ TEST_F(CollectionTest, DeletionOfADocument) {nlohmann::json results;// asserts before removing any record- results = collection_for_del->search("cryogenic", query_fields, "", {}, sort_fields, {0}, 5, 1, FREQUENCY, false).get();+ results = collection_for_del->search("cryogenic", query_fields, "", {}, sort_fields, {0}, 5, 1, FREQUENCY, {false}).get();ASSERT_EQ(1, results["hits"].size());it = store->get_iterator();@@ -1789,16 +1789,16 @@ TEST_F(CollectionTest, DeletionOfADocument) {// actually remove a record nowcollection_for_del->remove("1");- results = collection_for_del->search("cryogenic", query_fields, "", {}, sort_fields, {0}, 5, 1, FREQUENCY, false).get();+ results = collection_for_del->search("cryogenic", query_fields, "", {}, sort_fields, {0}, 5, 1, FREQUENCY, {false}).get();ASSERT_EQ(0, results["hits"].size());ASSERT_EQ(0, results["found"]);- results = collection_for_del->search("archives", query_fields, "", {}, sort_fields, {0}, 5, 1, FREQUENCY, false).get();+ results = collection_for_del->search("archives", query_fields, "", {}, sort_fields, {0}, 5, 1, FREQUENCY, {false}).get();ASSERT_EQ(1, results["hits"].size());ASSERT_EQ(1, results["found"]);collection_for_del->remove("foo"); // custom id record- results = collection_for_del->search("martian", query_fields, "", {}, sort_fields, {0}, 5, 1, FREQUENCY, false).get();+ results = collection_for_del->search("martian", query_fields, "", {}, sort_fields, {0}, 5, 1, FREQUENCY, {false}).get();ASSERT_EQ(0, results["hits"].size());ASSERT_EQ(0, results["found"]);@@ -1848,7 +1848,7 @@ TEST_F(CollectionTest, DeletionOfDocumentSingularFields) {ASSERT_TRUE(add_op.ok());nlohmann::json res = coll1->search("phone", {"str"}, "", {}, sort_fields, {0}, 10, 1,- token_ordering::FREQUENCY, true, 10, spp::sparse_hash_set<std::string>(),+ token_ordering::FREQUENCY, {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10).get();ASSERT_EQ(1, res["found"]);@@ -1858,7 +1858,7 @@ TEST_F(CollectionTest, DeletionOfDocumentSingularFields) {ASSERT_TRUE(rem_op.ok());res = coll1->search("phone", {"str"}, "", {}, sort_fields, {0}, 10, 1,- token_ordering::FREQUENCY, true, 10, spp::sparse_hash_set<std::string>(),+ token_ordering::FREQUENCY, {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10).get();ASSERT_EQ(0, res["found"].get<int32_t>());@@ -1914,7 +1914,7 @@ TEST_F(CollectionTest, DeletionOfDocumentArrayFields) {ASSERT_TRUE(add_op.ok());nlohmann::json res = coll1->search("phone", {"strarray"}, "", {}, sort_fields, {0}, 10, 1,- token_ordering::FREQUENCY, true, 10, spp::sparse_hash_set<std::string>(),+ token_ordering::FREQUENCY, {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10).get();ASSERT_EQ(1, res["found"]);@@ -1924,7 +1924,7 @@ TEST_F(CollectionTest, DeletionOfDocumentArrayFields) {ASSERT_TRUE(rem_op.ok());res = coll1->search("phone", {"strarray"}, "", {}, sort_fields, {0}, 10, 1,- token_ordering::FREQUENCY, true, 10, spp::sparse_hash_set<std::string>(),+ token_ordering::FREQUENCY, {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10).get();ASSERT_EQ(0, res["found"].get<int32_t>());@@ -2103,7 +2103,7 @@ TEST_F(CollectionTest, SearchHighlightShouldFollowThreshold) {// first with a large thresholdauto res = coll1->search("lazy", {"title"}, "", {}, sort_fields, {0}, 10, 1,- token_ordering::FREQUENCY, true, 10, spp::sparse_hash_set<std::string>(),+ token_ordering::FREQUENCY, {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "").get();ASSERT_STREQ("The quick brown fox jumped over the <mark>lazy</mark> dog and ran straight to the forest to sleep.",@@ -2112,7 +2112,7 @@ TEST_F(CollectionTest, SearchHighlightShouldFollowThreshold) {// now with with a small threshold (will show only 4 words either side of the matched token)res = coll1->search("lazy", {"title"}, "", {}, sort_fields, {0}, 10, 1,- token_ordering::FREQUENCY, true, 10, spp::sparse_hash_set<std::string>(),+ token_ordering::FREQUENCY, {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 5).get();ASSERT_STREQ("fox jumped over the <mark>lazy</mark> dog and ran straight",@@ -2122,14 +2122,14 @@ TEST_F(CollectionTest, SearchHighlightShouldFollowThreshold) {size_t highlight_affix_num_tokens = 2;res = coll1->search("lazy", {"title"}, "", {}, sort_fields, {0}, 10, 1,- token_ordering::FREQUENCY, true, 10, spp::sparse_hash_set<std::string>(),+ token_ordering::FREQUENCY, {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 5, highlight_affix_num_tokens).get();ASSERT_STREQ("over the <mark>lazy</mark> dog and",res["hits"][0]["highlights"][0]["snippet"].get<std::string>().c_str());highlight_affix_num_tokens = 0;res = coll1->search("lazy", {"title"}, "", {}, sort_fields, {0}, 10, 1,- token_ordering::FREQUENCY, true, 10, spp::sparse_hash_set<std::string>(),+ token_ordering::FREQUENCY, {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 5, highlight_affix_num_tokens).get();ASSERT_STREQ("<mark>lazy</mark>",res["hits"][0]["highlights"][0]["snippet"].get<std::string>().c_str());@@ -2161,7 +2161,7 @@ TEST_F(CollectionTest, SearchHighlightShouldUseHighlightTags) {// use non-default highlighting tagsauto res = coll1->search("lazy", {"title"}, "", {}, sort_fields, {0}, 10, 1,- token_ordering::FREQUENCY, true, 10, spp::sparse_hash_set<std::string>(),+ token_ordering::FREQUENCY, {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 30, 4, "", 40, {}, {}, {}, 0,"<em class=\"h\">", "</em>").get();@@ -2193,7 +2193,7 @@ TEST_F(CollectionTest, SearchHighlightWithNewLine) {ASSERT_TRUE(add_op.ok());auto res = coll1->search("stark", {"title"}, "", {}, sort_fields, {0}, 10, 1,- token_ordering::FREQUENCY, true, 10, spp::sparse_hash_set<std::string>(),+ token_ordering::FREQUENCY, {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 30, 4, "", 40, {}, {}, {}, 0).get();ASSERT_STREQ("Blah, blah\n<mark>Stark</mark> Industries",@@ -2228,7 +2228,7 @@ TEST_F(CollectionTest, UpdateDocument) {ASSERT_TRUE(add_op.ok());auto res = coll1->search("lazy", {"title"}, "", {"tags"}, sort_fields, {0}, 10, 1,- token_ordering::FREQUENCY, true, 10, spp::sparse_hash_set<std::string>(),+ token_ordering::FREQUENCY, {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 5, 5, "title").get();ASSERT_EQ(1, res["hits"].size());@@ -2240,7 +2240,7 @@ TEST_F(CollectionTest, UpdateDocument) {ASSERT_TRUE(add_op.ok());res = coll1->search("lazy", {"title"}, "", {"tags"}, sort_fields, {0}, 10, 1,- token_ordering::FREQUENCY, true, 10, spp::sparse_hash_set<std::string>(),+ token_ordering::FREQUENCY, {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 5, 5, "title").get();ASSERT_EQ(1, res["hits"].size());@@ -2262,13 +2262,13 @@ TEST_F(CollectionTest, UpdateDocument) {ASSERT_EQ(1, coll1->get_num_documents());res = coll1->search("lazy", {"title"}, "", {"tags"}, sort_fields, {0}, 10, 1,- token_ordering::FREQUENCY, true, 10, spp::sparse_hash_set<std::string>(),+ token_ordering::FREQUENCY, {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 5, 5, "title").get();ASSERT_EQ(0, res["hits"].size());res = coll1->search("quick", {"title"}, "", {"title"}, sort_fields, {0}, 10, 1,- token_ordering::FREQUENCY, true, 10, spp::sparse_hash_set<std::string>(),+ token_ordering::FREQUENCY, {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 5, 5, "title").get();ASSERT_EQ(1, res["hits"].size());@@ -2288,14 +2288,14 @@ TEST_F(CollectionTest, UpdateDocument) {// check for old tagres = coll1->search("NEWS", {"tags"}, "", {"tags"}, sort_fields, {0}, 10, 1,- token_ordering::FREQUENCY, true, 10, spp::sparse_hash_set<std::string>(),+ token_ordering::FREQUENCY, {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 5, 5, "title").get();ASSERT_EQ(0, res["hits"].size());// now check for new tag and also try faceting on that fieldres = coll1->search("SENTENCE", {"tags"}, "", {"tags"}, sort_fields, {0}, 10, 1,- token_ordering::FREQUENCY, true, 10, spp::sparse_hash_set<std::string>(),+ token_ordering::FREQUENCY, {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 5, 5, "title").get();ASSERT_EQ(1, res["hits"].size());@@ -2310,7 +2310,7 @@ TEST_F(CollectionTest, UpdateDocument) {ASSERT_TRUE(add_op.ok());res = coll1->search("*", {"tags"}, "points: > 90", {"tags"}, sort_fields, {0}, 10, 1,- token_ordering::FREQUENCY, true, 10, spp::sparse_hash_set<std::string>(),+ token_ordering::FREQUENCY, {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 5, 5, "title").get();ASSERT_EQ(1, res["hits"].size());@@ -2324,7 +2324,7 @@ TEST_F(CollectionTest, UpdateDocument) {ASSERT_TRUE(add_op.ok());res = coll1->search("*", {"tags"}, "points: > 101", {"tags"}, sort_fields, {0}, 10, 1,- token_ordering::FREQUENCY, true, 10, spp::sparse_hash_set<std::string>(),+ token_ordering::FREQUENCY, {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 5, 5, "title").get();ASSERT_EQ(1, res["hits"].size());@@ -2336,7 +2336,7 @@ TEST_F(CollectionTest, UpdateDocument) {ASSERT_FALSE(add_op.ok());res = coll1->search("*", {"tags"}, "points: > 101", {"tags"}, sort_fields, {0}, 10, 1,- token_ordering::FREQUENCY, true, 10, spp::sparse_hash_set<std::string>(),+ token_ordering::FREQUENCY, {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 5, 5, "title").get();ASSERT_EQ(1, res["hits"].size());@@ -2399,7 +2399,7 @@ TEST_F(CollectionTest, UpdateDocumentSorting) {coll1->add(doc2.dump());auto res = coll1->search("*", {"tags"}, "", {"tags"}, sort_fields, {0}, 10, 1,- token_ordering::FREQUENCY, true, 10, spp::sparse_hash_set<std::string>(),+ token_ordering::FREQUENCY, {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 5, 5, "title").get();ASSERT_EQ(2, res["hits"].size());@@ -2414,7 +2414,7 @@ TEST_F(CollectionTest, UpdateDocumentSorting) {coll1->add(doc1.dump(), UPDATE);res = coll1->search("*", {"tags"}, "", {"tags"}, sort_fields, {0}, 10, 1,- token_ordering::FREQUENCY, true, 10, spp::sparse_hash_set<std::string>(),+ token_ordering::FREQUENCY, {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 5, 5, "title").get();ASSERT_EQ(2, res["hits"].size());@@ -2450,7 +2450,7 @@ TEST_F(CollectionTest, UpdateDocumentUnIndexedField) {ASSERT_TRUE(add_op.ok());auto res = coll1->search("lazy", {"title"}, "", {}, sort_fields, {0}, 10, 1,- token_ordering::FREQUENCY, true, 10, spp::sparse_hash_set<std::string>(),+ token_ordering::FREQUENCY, {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 5, 5, "title").get();ASSERT_EQ(1, res["hits"].size());@@ -2463,7 +2463,7 @@ TEST_F(CollectionTest, UpdateDocumentUnIndexedField) {ASSERT_TRUE(add_op.ok());res = coll1->search("lazy", {"title"}, "", {}, sort_fields, {0}, 10, 1,- token_ordering::FREQUENCY, true, 10, spp::sparse_hash_set<std::string>(),+ token_ordering::FREQUENCY, {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 5, 5, "title").get();ASSERT_EQ(1, res["hits"].size());@@ -2498,7 +2498,7 @@ TEST_F(CollectionTest, SearchHighlightFieldFully) {// look for fully highlighted value in responseauto res = coll1->search("lazy", {"title"}, "", {}, sort_fields, {0}, 10, 1,- token_ordering::FREQUENCY, true, 10, spp::sparse_hash_set<std::string>(),+ token_ordering::FREQUENCY, {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 5, 5, "title").get();ASSERT_EQ(1, res["hits"][0]["highlights"].size());@@ -2507,14 +2507,14 @@ TEST_F(CollectionTest, SearchHighlightFieldFully) {// should not return value key when highlight_full_fields is not specifiedres = coll1->search("lazy", {"title"}, "", {}, sort_fields, {0}, 10, 1,- token_ordering::FREQUENCY, true, 10, spp::sparse_hash_set<std::string>(),+ token_ordering::FREQUENCY, {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 5, 5, "").get();ASSERT_EQ(3, res["hits"][0]["highlights"][0].size());// query multiple fieldsres = coll1->search("lazy", {"title", "tags"}, "", {}, sort_fields, {0}, 10, 1,- token_ordering::FREQUENCY, true, 10, spp::sparse_hash_set<std::string>(),+ token_ordering::FREQUENCY, {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 5, 5, "title, tags").get();ASSERT_EQ(2, res["hits"][0]["highlights"].size());@@ -2531,7 +2531,7 @@ TEST_F(CollectionTest, SearchHighlightFieldFully) {// excluded fields should not be returned in highlights sectionspp::sparse_hash_set<std::string> excluded_fields = {"tags"};res = coll1->search("lazy", {"title", "tags"}, "", {}, sort_fields, {0}, 10, 1,- token_ordering::FREQUENCY, true, 10, spp::sparse_hash_set<std::string>(),+ token_ordering::FREQUENCY, {true}, 10, spp::sparse_hash_set<std::string>(),excluded_fields, 10, "", 5, 5, "title, tags").get();ASSERT_EQ(1, res["hits"][0]["highlights"].size());@@ -2541,7 +2541,7 @@ TEST_F(CollectionTest, SearchHighlightFieldFully) {// when all fields are excludedexcluded_fields = {"tags", "title"};res = coll1->search("lazy", {"title", "tags"}, "", {}, sort_fields, {0}, 10, 1,- token_ordering::FREQUENCY, true, 10, spp::sparse_hash_set<std::string>(),+ token_ordering::FREQUENCY, {true}, 10, spp::sparse_hash_set<std::string>(),excluded_fields, 10, "", 5, 5, "title, tags").get();ASSERT_EQ(0, res["hits"][0]["highlights"].size());@@ -2581,26 +2581,26 @@ TEST_F(CollectionTest, OptionalFields) {// first must be able to fetch all records (i.e. all must have been indexed)- auto res = coll1->search("*", {"title"}, "", {}, {}, {0}, 10, 1, FREQUENCY, false).get();+ auto res = coll1->search("*", {"title"}, "", {}, {}, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(6, res["found"].get<size_t>());// search on optional `description` field- res = coll1->search("book", {"description"}, "", {}, {}, {0}, 10, 1, FREQUENCY, false).get();+ res = coll1->search("book", {"description"}, "", {}, {}, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(5, res["found"].get<size_t>());// filter on optional `average` field- res = coll1->search("the", {"title"}, "average: >0", {}, {}, {0}, 10, 1, FREQUENCY, false).get();+ res = coll1->search("the", {"title"}, "average: >0", {}, {}, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(5, res["found"].get<size_t>());// facet on optional `description` field- res = coll1->search("the", {"title"}, "", {"description"}, {}, {0}, 10, 1, FREQUENCY, false).get();+ res = coll1->search("the", {"title"}, "", {"description"}, {}, {0}, 10, 1, FREQUENCY, {false}).get();ASSERT_EQ(6, res["found"].get<size_t>());ASSERT_EQ(5, res["facet_counts"][0]["counts"][0]["count"].get<size_t>());ASSERT_STREQ("description", res["facet_counts"][0]["field_name"].get<std::string>().c_str());// sort_by optional `average` field should be allowed (default used for missing values)std::vector<sort_by> sort_fields = { sort_by("average", "DESC") };- auto res_op = coll1->search("*", {"title"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, false);+ auto res_op = coll1->search("*", {"title"}, "", {}, sort_fields, {0}, 10, 1, FREQUENCY, {false});ASSERT_TRUE(res_op.ok());res = res_op.get();@@ -2723,28 +2723,28 @@ TEST_F(CollectionTest, WildcardQueryReturnsResultsBasedOnPerPageParam) {std::vector<std::string> facets;spp::sparse_hash_set<std::string> empty;nlohmann::json results = collection->search("*", query_fields, "", facets, sort_fields, {0}, 12, 1,- FREQUENCY, false, 1000, empty, empty, 10).get();+ FREQUENCY, {false}, 1000, empty, empty, 10).get();ASSERT_EQ(12, results["hits"].size());ASSERT_EQ(25, results["found"].get<int>());// should match collection sizeresults = collection->search("*", query_fields, "", facets, sort_fields, {0}, 100, 1,- FREQUENCY, false, 1000, empty, empty, 10).get();+ FREQUENCY, {false}, 1000, empty, empty, 10).get();ASSERT_EQ(25, results["hits"].size());ASSERT_EQ(25, results["found"].get<int>());// cannot fetch more than in-built limit of 250auto res_op = collection->search("*", query_fields, "", facets, sort_fields, {0}, 251, 1,- FREQUENCY, false, 1000, empty, empty, 10);+ FREQUENCY, {false}, 1000, empty, empty, 10);ASSERT_FALSE(res_op.ok());ASSERT_EQ(422, res_op.code());ASSERT_STREQ("Only upto 250 hits can be fetched per page.", res_op.error().c_str());// when page number is not validres_op = collection->search("*", query_fields, "", facets, sort_fields, {0}, 10, 0,- FREQUENCY, false, 1000, empty, empty, 10);+ FREQUENCY, {false}, 1000, empty, empty, 10);ASSERT_FALSE(res_op.ok());ASSERT_EQ(422, res_op.code());ASSERT_STREQ("Page must be an integer of value greater than 0.", res_op.error().c_str());@@ -2752,26 +2752,26 @@ TEST_F(CollectionTest, WildcardQueryReturnsResultsBasedOnPerPageParam) {// do paginationresults = collection->search("*", query_fields, "", facets, sort_fields, {0}, 10, 1,- FREQUENCY, false, 1000, empty, empty, 10).get();+ FREQUENCY, {false}, 1000, empty, empty, 10).get();ASSERT_EQ(10, results["hits"].size());ASSERT_EQ(25, results["found"].get<int>());results = collection->search("*", query_fields, "", facets, sort_fields, {0}, 10, 2,- FREQUENCY, false, 1000, empty, empty, 10).get();+ FREQUENCY, {false}, 1000, empty, empty, 10).get();ASSERT_EQ(10, results["hits"].size());ASSERT_EQ(25, results["found"].get<int>());results = collection->search("*", query_fields, "", facets, sort_fields, {0}, 10, 3,- FREQUENCY, false, 1000, empty, empty, 10).get();+ FREQUENCY, {false}, 1000, empty, empty, 10).get();ASSERT_EQ(5, results["hits"].size());ASSERT_EQ(25, results["found"].get<int>());// enforce limit_hitsres_op = collection->search("*", query_fields, "", facets, sort_fields, {0}, 10, 3,- FREQUENCY, false, 1000,+ FREQUENCY, {false}, 1000,spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 30, 4, "", 40, {}, {}, {}, 0,"<mark>", "</mark>", {1}, 20);@@ -2806,7 +2806,7 @@ TEST_F(CollectionTest, RemoveIfFound) {}auto res = coll1->search("*", {"title"}, "", {}, sort_fields, {0}, 10, 1,- token_ordering::FREQUENCY, true, 10, spp::sparse_hash_set<std::string>(),+ token_ordering::FREQUENCY, {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 30, 4, "", 40, {}, {}, {}, 0).get();ASSERT_EQ(10, res["found"].get<int>());@@ -2986,7 +2986,7 @@ TEST_F(CollectionTest, MultiFieldRelevance2) {results = coll1->search("on a jetplane",{"title", "artist"}, "", {}, {}, {0}, 10, 1, FREQUENCY,- true, 10, spp::sparse_hash_set<std::string>(),+ {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 30, 4, "", 40, {}, {}, {}, 0,"<mark>", "</mark>", {1, 4}).get();@@ -3011,7 +3011,7 @@ TEST_F(CollectionTest, FieldWeightsNotProper) {auto results_op = coll1->search("on a jetplane",{"title", "artist"}, "", {}, {}, {0}, 10, 1, FREQUENCY,- true, 10, spp::sparse_hash_set<std::string>(),+ {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 30, 4, "", 40, {}, {}, {}, 0,"<mark>", "</mark>", {1});@@ -3021,7 +3021,7 @@ TEST_F(CollectionTest, FieldWeightsNotProper) {results_op = coll1->search("on a jetplane",{"title"}, "", {}, {}, {0}, 10, 1, FREQUENCY,- true, 10, spp::sparse_hash_set<std::string>(),+ {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 30, 4, "", 40, {}, {}, {}, 0,"<mark>", "</mark>", {2, 1});@@ -3033,7 +3033,7 @@ TEST_F(CollectionTest, FieldWeightsNotProper) {results_op = coll1->search("on a jetplane",{"title"}, "", {}, {}, {0}, 10, 1, FREQUENCY,- true, 10, spp::sparse_hash_set<std::string>(),+ {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 30, 4, "", 40, {}, {}, {}, 0,"<mark>", "</mark>", {});@@ -3072,7 +3072,7 @@ TEST_F(CollectionTest, MultiFieldRelevance3) {auto results = coll1->search("style taylor swift",{"title", "artist"}, "", {}, {}, {0}, 10, 1, FREQUENCY,- true, 10, spp::sparse_hash_set<std::string>(),+ {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 30, 4, "", 40, {}, {}, {}, 0,"<mark>", "</mark>", {1, 1}).get();@@ -3084,7 +3084,7 @@ TEST_F(CollectionTest, MultiFieldRelevance3) {results = coll1->search("swift",{"title", "artist"}, "", {}, {}, {0}, 10, 1, FREQUENCY,- true, 10, spp::sparse_hash_set<std::string>(),+ {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 30, 4, "", 40, {}, {}, {}, 0,"<mark>", "</mark>", {1, 1}).get();@@ -3127,7 +3127,7 @@ TEST_F(CollectionTest, MultiFieldRelevance4) {auto results = coll1->search("madras",{"title", "artist"}, "", {}, {}, {2}, 10, 1, FREQUENCY,- true, 10, spp::sparse_hash_set<std::string>(),+ {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 30, 4, "", 40, {}, {}, {}, 0,"<mark>", "</mark>", {1, 1}).get();@@ -3173,7 +3173,7 @@ TEST_F(CollectionTest, MultiFieldRelevance5) {auto results = coll1->search("Canada",{"company_name","country","field_a"}, "", {}, {}, {2}, 10, 1, FREQUENCY,- true, 10, spp::sparse_hash_set<std::string>(),+ {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 30, 4, "", 40, {}, {}, {}, 0,"<mark>", "</mark>", {1, 1, 1}).get();@@ -3186,7 +3186,7 @@ TEST_F(CollectionTest, MultiFieldRelevance5) {results = coll1->search("Canada",{"company_name","field_a","country"}, "", {}, {}, {2}, 10, 1, FREQUENCY,- true, 10, spp::sparse_hash_set<std::string>(),+ {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 30, 4, "", 40, {}, {}, {}, 0,"<mark>", "</mark>", {1, 1, 1}).get();@@ -3243,7 +3243,7 @@ TEST_F(CollectionTest, MultiFieldRelevance6) {auto results = coll1->search("taylor swift",{"title", "artist"}, "", {}, {}, {2}, 10, 1, FREQUENCY,- true, 10, spp::sparse_hash_set<std::string>(),+ {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 30, 4, "", 40, {}, {}, {}, 0,"<mark>", "</mark>", {1, 1}).get();@@ -3256,7 +3256,7 @@ TEST_F(CollectionTest, MultiFieldRelevance6) {// when exact matches are disabledresults = coll1->search("taylor swift",{"title", "artist"}, "", {}, {}, {2}, 10, 1, FREQUENCY,- true, 10, spp::sparse_hash_set<std::string>(),+ {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 30, 4, "", 40, {}, {}, {}, 0,"<mark>", "</mark>", {1, 1}, 100, false).get();@@ -3300,7 +3300,7 @@ TEST_F(CollectionTest, ExactMatch) {auto results = coll1->search("alpha beta",{"title"}, "", {}, {}, {2}, 10, 1, FREQUENCY,- true, 10).get();+ {true}, 10).get();ASSERT_EQ(2, results["found"].get<size_t>());ASSERT_EQ(2, results["hits"].size());@@ -3308,7 +3308,7 @@ TEST_F(CollectionTest, ExactMatch) {ASSERT_STREQ("1", results["hits"][0]["document"]["id"].get<std::string>().c_str());ASSERT_STREQ("2", results["hits"][1]["document"]["id"].get<std::string>().c_str());- results = coll1->search("alpha", {"title"}, "", {}, {}, {2}, 10, 1, FREQUENCY, true, 10).get();+ results = coll1->search("alpha", {"title"}, "", {}, {}, {2}, 10, 1, FREQUENCY, {true}, 10).get();ASSERT_EQ(3, results["found"].get<size_t>());ASSERT_EQ(3, results["hits"].size());@@ -3359,7 +3359,7 @@ TEST_F(CollectionTest, MultiFieldHighlighting) {auto results = coll1->search("charger",{"name","description","categories"}, "", {}, {}, {2}, 10, 1, FREQUENCY,- true, 10, spp::sparse_hash_set<std::string>(),+ {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 30, 4, "", 40, {}, {}, {}, 0,"<mark>", "</mark>", {1, 1, 1}).get();@@ -3379,7 +3379,7 @@ TEST_F(CollectionTest, MultiFieldHighlighting) {results = coll1->search("John With Denver",{"description"}, "", {}, {}, {0}, 10, 1, FREQUENCY,- true, 1, spp::sparse_hash_set<std::string>(),+ {true}, 1, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 30, 4, "", 40, {}, {}, {}, 0,"<mark>", "</mark>", {1}).get();@@ -3394,7 +3394,7 @@ TEST_F(CollectionTest, MultiFieldHighlighting) {results = coll1->search("Annies song John Denver",{"name","description"}, "", {}, {}, {0}, 10, 1, FREQUENCY,- true, 1, spp::sparse_hash_set<std::string>(),+ {true}, 1, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 30, 4, "", 40, {}, {}, {}, 0,"<mark>", "</mark>", {1, 1}).get();@@ -3452,7 +3452,7 @@ TEST_F(CollectionTest, MultiFieldMatchRanking) {}auto results = coll1->search("taylor swift style",- {"artist", "title"}, "", {}, {}, {0}, 3, 1, FREQUENCY, true, 5).get();+ {"artist", "title"}, "", {}, {}, {0}, 3, 1, FREQUENCY, {true}, 5).get();ASSERT_EQ(10, results["found"].get<size_t>());ASSERT_EQ(3, results["hits"].size());@@ -3495,7 +3495,7 @@ TEST_F(CollectionTest, MultiFieldMatchRankingOnArray) {}auto results = coll1->search("golang vue",- {"strong_skills", "skills"}, "", {}, {}, {0}, 3, 1, FREQUENCY, true, 5).get();+ {"strong_skills", "skills"}, "", {}, {}, {0}, 3, 1, FREQUENCY, {true}, 5).get();ASSERT_EQ(2, results["found"].get<size_t>());ASSERT_EQ(2, results["hits"].size());@@ -3535,7 +3535,7 @@ TEST_F(CollectionTest, MultiFieldMatchRankingOnFieldOrder) {}auto results = coll1->search("michael jackson toxic",- {"title", "artist"}, "", {}, {}, {0}, 3, 1, FREQUENCY, true, 5).get();+ {"title", "artist"}, "", {}, {}, {0}, 3, 1, FREQUENCY, {true}, 5).get();ASSERT_EQ(2, results["found"].get<size_t>());ASSERT_EQ(2, results["hits"].size());@@ -3574,7 +3574,7 @@ TEST_F(CollectionTest, PrefixRankedAfterExactMatch) {ASSERT_TRUE(coll1->add(doc.dump()).ok());}- auto results = coll1->search("roti", {"title"}, "", {}, {}, {0}, 3, 1, FREQUENCY, true, 5).get();+ auto results = coll1->search("roti", {"title"}, "", {}, {}, {0}, 3, 1, FREQUENCY, {true}, 5).get();ASSERT_EQ(4, results["found"].get<size_t>());ASSERT_EQ(3, results["hits"].size());@@ -3749,7 +3749,7 @@ TEST_F(CollectionTest, FieldSpecificNumTypos) {auto results = coll1->search("tayylor",{"title", "artist"}, "", {}, {}, {1, 1}, 10, 1, FREQUENCY,- true, 10, spp::sparse_hash_set<std::string>(),+ {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 30, 4, "", 40, {}, {}, {}, 0,"<mark>", "</mark>", {1, 1}).get();@@ -3762,7 +3762,7 @@ TEST_F(CollectionTest, FieldSpecificNumTypos) {results = coll1->search("tayylor",{"title", "artist"}, "", {}, {}, {0, 1}, 10, 1, FREQUENCY,- true, 10, spp::sparse_hash_set<std::string>(),+ {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 30, 4, "", 40, {}, {}, {}, 0,"<mark>", "</mark>", {1, 1}).get();@@ -3774,7 +3774,7 @@ TEST_F(CollectionTest, FieldSpecificNumTypos) {// must return error when num_typos does not match length of search fields queriedauto res_op = coll1->search("tayylor",{"title"}, "", {}, {}, {0, 1}, 10, 1, FREQUENCY,- true, 10, spp::sparse_hash_set<std::string>(),+ {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 30, 4, "", 40, {}, {}, {}, 0,"<mark>", "</mark>", {1, 1});@@ -3784,7 +3784,7 @@ TEST_F(CollectionTest, FieldSpecificNumTypos) {// can use a single typo param for multiple fieldsresults = coll1->search("tayylor",{"title", "artist"}, "", {}, {}, {1}, 10, 1, FREQUENCY,- true, 10, spp::sparse_hash_set<std::string>(),+ {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 30, 4, "", 40, {}, {}, {}, 0,"<mark>", "</mark>", {1, 1}).get();@@ -3794,7 +3794,7 @@ TEST_F(CollectionTest, FieldSpecificNumTypos) {// wildcard search with typosresults = coll1->search("*",{}, "", {}, {}, {1}, 10, 1, FREQUENCY,- true, 10, spp::sparse_hash_set<std::string>(),+ {true}, 10, spp::sparse_hash_set<std::string>(),spp::sparse_hash_set<std::string>(), 10, "", 30, 4, "", 40, {}, {}, {}, 0,"<mark>", "</mark>", {1, 1}).get();@@ -3832,7 +3832,7 @@ TEST_F(CollectionTest, BadHighlightingOnText) {ASSERT_TRUE(coll1->add(doc.dump()).ok());auto results = coll1->search("natural saint lucia", {"text"}, "", {}, {}, {1}, 10, 1, FREQUENCY,- true, 10).get();+ {true}, 10).get();ASSERT_EQ(1, results["found"].get<size_t>());ASSERT_EQ(1, results["hits"].size());@@ -3846,3 +3846,57 @@ TEST_F(CollectionTest, BadHighlightingOnText) {collectionManager.drop_collection("coll1");}++TEST_F(CollectionTest, FieldLevelPrefixConfiguration) {+ Collection *coll1;++ std::vector<field> fields = {field("title", field_types::STRING, false),+ field("artist", field_types::STRING, false),+ field("points", field_types::INT32, false),};++ coll1 = collectionManager.get_collection("coll1").get();+ if(coll1 == nullptr) {+ coll1 = collectionManager.create_collection("coll1", 1, fields, "points").get();+ }++ std::vector<std::vector<std::string>> records = {+ {"Taylor Swift Karaoke: reputation", "Taylor Swift"},+ {"Style", "Taylor Swift"},+ };++ for(size_t i=0; i<records.size(); i++) {+ nlohmann::json doc;++ doc["id"] = std::to_string(i);+ doc["title"] = records[i][0];+ doc["artist"] = records[i][1];+ doc["points"] = i;++ ASSERT_TRUE(coll1->add(doc.dump()).ok());+ }++ auto results = coll1->search("taylo",+ {"title", "artist"}, "", {}, {}, {0}, 10, 1, FREQUENCY,+ {true, false}, 10, spp::sparse_hash_set<std::string>(),+ spp::sparse_hash_set<std::string>(), 10, "", 30, 4, "", 40, {}, {}, {}, 0,+ "<mark>", "</mark>", {1, 1}).get();++ ASSERT_EQ(1, results["found"].get<size_t>());+ ASSERT_EQ(1, results["hits"].size());++ ASSERT_STREQ("0", results["hits"][0]["document"]["id"].get<std::string>().c_str());++ results = coll1->search("taylo",+ {"title", "artist"}, "", {}, {}, {0}, 10, 1, FREQUENCY,+ {true, true}, 10, spp::sparse_hash_set<std::string>(),+ spp::sparse_hash_set<std::string>(), 10, "", 30, 4, "", 40, {}, {}, {}, 0,+ "<mark>", "</mark>", {1, 1}).get();++ ASSERT_EQ(2, results["found"].get<size_t>());+ ASSERT_EQ(2, results["hits"].size());++ ASSERT_STREQ("0", results["hits"][0]["document"]["id"].get<std::string>().c_str());+ ASSERT_STREQ("1", results["hits"][1]["document"]["id"].get<std::string>().c_str());++ collectionManager.drop_collection("coll1");+}