fix: [2.4] Fix bug for Search fails with filter expression contains underscore (#38302)

Enhance the matching for elements within the UnaryRangeArray
https://github.com/milvus-io/milvus/issues/38068

---------

Signed-off-by: Xianhui.Lin <xianhui.lin@zilliz.com>
pull/38548/head
Xianhui Lin 2024-12-18 10:22:47 +08:00 committed by GitHub
parent 989c66c7eb
commit c24f666f1b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 0 deletions

View File

@ -315,6 +315,11 @@ PhyUnaryRangeFilterExpr::ExecRangeVisitorImplArray() {
func(data, size, val, index, res);
break;
}
case proto::plan::Match: {
UnaryElementFuncForArray<ValueType, proto::plan::Match> func;
func(data, size, val, index, res);
break;
}
default:
PanicInfo(
OpTypeInvalid,

View File

@ -184,6 +184,20 @@ struct UnaryElementFuncForArray {
UnaryArrayCompare(array_data <= val);
} else if constexpr (op == proto::plan::OpType::PrefixMatch) {
UnaryArrayCompare(milvus::query::Match(array_data, val, op));
} else if constexpr (op == proto::plan::OpType::Match) {
if constexpr (std::is_same_v<GetType, proto::plan::Array>) {
res[i] = false;
} else {
if (index >= src[i].length()) {
res[i] = false;
continue;
}
PatternMatchTranslator translator;
auto regex_pattern = translator(val);
RegexMatcher matcher(regex_pattern);
auto array_data = src[i].template get_data<GetType>(index);
res[i] = matcher(array_data);
}
} else {
PanicInfo(OpTypeInvalid,
"unsupported op_type:{} for "