Skip to content

Commit

Permalink
fix: Fix bug for Search fails with filter expression contains undersc…
Browse files Browse the repository at this point in the history
…ore (#38085)

Enhance the matching for elements within the UnaryRangeArray
#38068

---------

Signed-off-by: Xianhui.Lin <[email protected]>
  • Loading branch information
JsDove authored Dec 5, 2024
1 parent 9b60694 commit 6d0a4fd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/core/src/exec/expression/UnaryExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,11 @@ PhyUnaryRangeFilterExpr::ExecRangeVisitorImplArray() {
func(data, valid_data, size, val, index, res, valid_res);
break;
}
case proto::plan::Match: {
UnaryElementFuncForArray<ValueType, proto::plan::Match> func;
func(data, valid_data, size, val, index, res, valid_res);
break;
}
default:
PanicInfo(
OpTypeInvalid,
Expand Down
14 changes: 14 additions & 0 deletions internal/core/src/exec/expression/UnaryExpr.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,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 "
Expand Down

0 comments on commit 6d0a4fd

Please sign in to comment.