fix: [2.4] Check all values for trie.predictive_search (#35943) (#35999)

Cherry-pick from master
pr: #35943 
Related to #35941

For marisa trie `predictive_search` default behavior, it value iterated
is not in lexicographic order.

This PR is a brute force fix to make range operator returns correct
values.

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
This commit is contained in:
congqixia 2024-09-05 16:49:04 +08:00 committed by GitHub
parent da0bc22a5f
commit ffa7755136
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -399,12 +399,8 @@ StringIndexMarisa::Range(std::string value, OpType op) {
auto key = std::string(agent.key().ptr(), agent.key().length());
if (key > value) {
ids.push_back(agent.key().id());
break;
}
};
while (trie_.predictive_search(agent)) {
ids.push_back(agent.key().id());
}
break;
}
case OpType::GreaterEqual: {
@ -412,12 +408,8 @@ StringIndexMarisa::Range(std::string value, OpType op) {
auto key = std::string(agent.key().ptr(), agent.key().length());
if (key >= value) {
ids.push_back(agent.key().id());
break;
}
}
while (trie_.predictive_search(agent)) {
ids.push_back(agent.key().id());
}
break;
}
case OpType::LessThan: {