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

chore: Weaviate - remove legacy filter support #1070

Merged
merged 5 commits into from
Sep 12, 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
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from haystack.dataclasses.document import Document
from haystack.document_stores.errors import DocumentStoreError, DuplicateDocumentError
from haystack.document_stores.types.policy import DuplicatePolicy
from haystack.utils.filters import convert

import weaviate
from weaviate.collections.classes.data import DataObject
Expand Down Expand Up @@ -388,7 +387,8 @@ def filter_documents(self, filters: Optional[Dict[str, Any]] = None) -> List[Doc
:returns: A list of Documents that match the given filters.
"""
if filters and "operator" not in filters and "conditions" not in filters:
filters = convert(filters)
msg = "Invalid filter syntax. See https://docs.haystack.deepset.ai/docs/metadata-filtering for details."
raise ValueError(msg)

result = []
if filters:
Expand Down
9 changes: 0 additions & 9 deletions integrations/weaviate/tests/test_document_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,15 +660,6 @@ def test_embedding_retrieval_with_distance_and_certainty(self, document_store):
with pytest.raises(ValueError):
document_store._embedding_retrieval(query_embedding=[], distance=0.1, certainty=0.1)

def test_filter_documents_with_legacy_filters(self, document_store):
docs = []
for index in range(10):
docs.append(Document(content="This is some content", meta={"index": index}))
document_store.write_documents(docs)
result = document_store.filter_documents({"content": {"$eq": "This is some content"}})

assert len(result) == 10

def test_filter_documents_below_default_limit(self, document_store):
docs = []
for index in range(9998):
Expand Down