Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix bug for Search fails with filter expression contains underscore #38085

Merged
merged 2 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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);

Check warning on line 325 in internal/core/src/exec/expression/UnaryExpr.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/exec/expression/UnaryExpr.cpp#L323-L325

Added lines #L323 - L325 were not covered by tests
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 @@
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;

Check warning on line 196 in internal/core/src/exec/expression/UnaryExpr.h

View check run for this annotation

Codecov / codecov/patch

internal/core/src/exec/expression/UnaryExpr.h#L196

Added line #L196 was not covered by tests
} else {
if (index >= src[i].length()) {
res[i] = false;
continue;

Check warning on line 200 in internal/core/src/exec/expression/UnaryExpr.h

View check run for this annotation

Codecov / codecov/patch

internal/core/src/exec/expression/UnaryExpr.h#L198-L200

Added lines #L198 - L200 were not covered by tests
}
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);

Check warning on line 206 in internal/core/src/exec/expression/UnaryExpr.h

View check run for this annotation

Codecov / codecov/patch

internal/core/src/exec/expression/UnaryExpr.h#L202-L206

Added lines #L202 - L206 were not covered by tests
}
} else {
PanicInfo(OpTypeInvalid,
"unsupported op_type:{} for "
Expand Down
Loading