mirror of
https://github.com/typesense/typesense.git
synced 2025-05-18 20:52:50 +08:00
Retain verbatim match on array.
This commit is contained in:
parent
a409df8dad
commit
43c26b1c7e
@ -4209,11 +4209,7 @@ int64_t Index::score_results2(const std::vector<sort_by> & sort_fields, const ui
|
||||
auto unique_words = field_is_array ? this_words_present : ((this_match_score >> 32) & 0xFF);
|
||||
auto typo_score = ((this_match_score >> 16) & 0xFF);
|
||||
auto proximity = ((this_match_score >> 8) & 0xFF);
|
||||
|
||||
// for array we have to compare with total query tokens to account for global context
|
||||
auto verbatim = field_is_array ?
|
||||
(this_match_score & 0xFF) && (int64_t)(num_query_tokens == this_words_present) :
|
||||
(this_match_score & 0xFF);
|
||||
auto verbatim = (this_match_score & 0xFF);
|
||||
|
||||
if(syn_orig_num_tokens != -1 && num_query_tokens == posting_lists.size()) {
|
||||
unique_words = syn_orig_num_tokens;
|
||||
|
@ -257,5 +257,6 @@ TEST_F(CollectionSpecificMoreTest, VerbatimMatchNotOnPartialTokenMatch) {
|
||||
"<mark>", "</mark>", {}, 1000, true).get();
|
||||
|
||||
ASSERT_EQ(2, results["hits"].size());
|
||||
ASSERT_EQ(results["hits"][0]["text_match"].get<size_t>(), results["hits"][1]["text_match"].get<size_t>());
|
||||
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());
|
||||
}
|
||||
|
@ -3687,7 +3687,8 @@ TEST_F(CollectionTest, MultiFieldMatchRankingOnArray) {
|
||||
ASSERT_EQ(2, results["found"].get<size_t>());
|
||||
ASSERT_EQ(2, results["hits"].size());
|
||||
|
||||
ASSERT_EQ(results["hits"][0]["text_match"].get<size_t>(), results["hits"][0]["text_match"].get<size_t>());
|
||||
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");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user