Add string_set_contains_any_of operator

Summary: Doc: https://docs.google.com/document/d/1miofxds9DJgWScj0zFyBbdpRH5Rj0T9FqiCapof5-vU/edit#heading=h.pg8svtdjlx7

Reviewed By: lblasa

Differential Revision: D49230134

fbshipit-source-id: aa8c4494e707dfbf70568517a50c1f5803fce32a
This commit is contained in:
Andrey Goncharov
2023-09-14 04:48:12 -07:00
committed by Facebook GitHub Bot
parent 17903c22f4
commit a27f4580a3

View File

@@ -36,6 +36,11 @@ export const dataTablePowerSearchOperators = {
key: 'string_not_matches_exactly',
valueType: 'STRING',
}),
string_set_contains_any_of: () => ({
label: 'contains any of',
key: 'string_set_contains_any_of',
valueType: 'STRING_SET',
}),
} satisfies {
[key: string]: (...args: any[]) => OperatorConfig;
};
@@ -57,4 +62,7 @@ export const dataTablePowerSearchOperatorProcessorConfig = {
value === searchValue,
string_not_matches_exactly: (operator, searchValue, value) =>
value !== searchValue,
// See PowerSearchStringSetTerm
string_set_contains_any_of: (operator, searchValue: string[], value) =>
searchValue.some((item) => (value as string).toLowerCase().includes(item)),
} satisfies PowerSearchOperatorProcessorConfig;