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

Array json fun for milvus data filter JSON_CONTAINS_ANY and JSON_CONTAINS_ALL #740

Merged
merged 4 commits into from
Jan 14, 2025
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: 4 additions & 1 deletion client/src/components/advancedSearch/Filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ const Filter = forwardRef((props: FilterProps, ref) => {
if (op === 'ARRAY_CONTAINS_ALL' || op === 'ARRAY_CONTAINS_ANY') {
newExpr = `${op}(${n}, ${value})`;
}

// rewrite expression if the op is JSON_CONTAINS_ANY/JSON_CONTAINS_ANY
if (op === 'JSON_CONTAINS_ALL' || op === 'JSON_CONTAINS_ANY') {
newExpr = `${op}(${n}, ${value})`;
}
return `${prev}${prev && !prev.endsWith('|| ') ? ' && ' : ''}${newExpr}`;
}, '');
func(expression);
Expand Down
4 changes: 4 additions & 0 deletions client/src/components/advancedSearch/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ export const formatValue = (value: string, type: string, operator: string) => {
case 'ARRAY_CONTAINS_ANY':
conditionValue = `[${value}]`;
break;
case 'JSON_CONTAINS_ALL':
case 'JSON_CONTAINS_ANY':
conditionValue = `[${value}]`;
break;
default:
conditionValue = `"${value}"`;
break;
Expand Down
8 changes: 8 additions & 0 deletions client/src/consts/Util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ export const LOGICAL_OPERATORS = [
value: 'ARRAY_CONTAINS_ANY',
label: 'ARRAY_CONTAINS_ANY',
},
{
value: 'JSON_CONTAINS_ALL',
label: 'JSON_CONTAINS_ALL',
},
{
value: 'JSON_CONTAINS_ANY',
label: 'JSON_CONTAINS_ANY',
},
];

export enum FILE_MIME_TYPE {
Expand Down
Loading