mirror of
https://github.com/typesense/typesense.git
synced 2025-05-22 06:40:30 +08:00
Fix a bug in phrase search + filtering.
This commit is contained in:
parent
609ac35c6d
commit
5b4b723672
@ -2206,6 +2206,10 @@ void Index::search(std::vector<query_tokens_t>& field_query_tokens,
|
||||
}
|
||||
}
|
||||
|
||||
if(!field_query_tokens[i].q_phrases.empty() && phrase_match_ids_size == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
auto actual_filter_ids = filter_ids;
|
||||
auto actual_filter_ids_length = filter_ids_length;
|
||||
|
||||
@ -2319,7 +2323,7 @@ void Index::search(std::vector<query_tokens_t>& field_query_tokens,
|
||||
}
|
||||
|
||||
if(phrase_match_ids_size != 0) {
|
||||
delete actual_filter_ids;
|
||||
delete [] actual_filter_ids;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2241,6 +2241,11 @@ TEST_F(CollectionSpecificTest, PhraseSearchMultipleFields) {
|
||||
|
||||
ASSERT_EQ(1, results["hits"].size());
|
||||
|
||||
results = coll1->search(R"("dog and cat")", {"title", "description"},
|
||||
"description: about", {}, {}, {2, 2}, 10, 1, FREQUENCY, {true, true}, 10).get();
|
||||
|
||||
ASSERT_EQ(1, results["hits"].size());
|
||||
|
||||
collectionManager.drop_collection("coll1");
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user