Merge branch 'single-index-concurrency' into v0.23

# Conflicts:
#	test/collection_specific_test.cpp
This commit is contained in:
Kishore Nallan 2021-12-01 16:41:57 +05:30
commit 54148545d0
2 changed files with 28 additions and 2 deletions

View File

@ -1352,7 +1352,9 @@ void Collection::parse_search_query(const std::string &query, std::vector<std::s
bool exclude_operator_prior = false;
for(auto& token: tokens) {
if(token[0] == '-') {
if(token == "-") {
continue;
} else if(token[0] == '-') {
exclude_operator_prior = true;
token = token.substr(1);
}

View File

@ -1998,4 +1998,28 @@ TEST_F(CollectionSpecificTest, SearchShouldJoinToken) {
ASSERT_EQ(0, results["hits"].size());
collectionManager.drop_collection("coll1");
}
}
TEST_F(CollectionSpecificTest, SingleHyphenInQueryNotToBeTreatedAsExclusion) {
std::vector<field> fields = {field("title", field_types::STRING, false),
field("points", field_types::INT32, false),};
Collection* coll1 = collectionManager.create_collection("coll1", 1, fields, "points").get();
nlohmann::json doc1;
doc1["id"] = "0";
doc1["title"] = "Saturday Short - Thrive (with Audio Descriptions + Open Captions)";
doc1["points"] = 100;
ASSERT_TRUE(coll1->add(doc1.dump()).ok());
auto results = coll1->search("Saturday Short - Thrive (with Audio Descriptions + Open Captions)", {"title"},
"", {}, {}, {2}, 10,
1, FREQUENCY, {true},
10, spp::sparse_hash_set<std::string>(),
spp::sparse_hash_set<std::string>(), 10, "", 30, 4, "title", 20, {}, {}, {}, 0,
"<mark>", "</mark>", {}, 1000, true).get();
ASSERT_EQ(1, results["hits"].size());
collectionManager.drop_collection("coll1");
}