Skip to content

Commit

Permalink
Fix filter syntax validation (#8477)
Browse files Browse the repository at this point in the history
  • Loading branch information
Amnah199 authored Oct 29, 2024
1 parent c7b8989 commit 811a54a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions haystack/utils/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ def raise_on_invalid_filter_syntax(filters: Optional[Dict[str, Any]] = None):
"""
Raise an error if the filter syntax is invalid.
"""
if filters and "operator" not in filters and "conditions" not in filters:
if filters and ("operator" not in filters or "conditions" not in filters):
msg = "Invalid filter syntax. See https://docs.haystack.deepset.ai/docs/metadata-filtering for details."
raise ValueError(msg)
raise FilterError(msg)


def document_matches_filter(filters: Dict[str, Any], document: Document) -> bool:
Expand Down

0 comments on commit 811a54a

Please sign in to comment.