Skip to content

Commit ec2aa93

Browse files
committed
improving filters
1 parent db3c1ae commit ec2aa93

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

  • integrations/alloydb/src/haystack_integrations/document_stores/alloydb

integrations/alloydb/src/haystack_integrations/document_stores/alloydb/filters.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,11 @@ def _like(field: Composable, value: Any) -> tuple[Composed, Any]:
247247
raise FilterError(msg)
248248
return SQL("{} LIKE %s").format(field), value
249249

250+
def _not_like(field: Composable, value: Any) -> tuple[Composed, Any]:
251+
if not isinstance(value, str):
252+
msg = f"{field}'s value must be a str when using 'not like'"
253+
raise FilterError(msg)
254+
return SQL("{} NOT LIKE %s").format(field), value
250255

251256
COMPARISON_OPERATORS = {
252257
"==": _equal,
@@ -257,5 +262,6 @@ def _like(field: Composable, value: Any) -> tuple[Composed, Any]:
257262
"<=": _less_than_equal,
258263
"in": _in,
259264
"not in": _not_in,
260-
"LIKE": _like,
265+
"like": _like,
266+
"not like": _not_like
261267
}

0 commit comments

Comments
 (0)