diff --git a/integrations/pinecone/src/haystack_integrations/document_stores/pinecone/document_store.py b/integrations/pinecone/src/haystack_integrations/document_stores/pinecone/document_store.py index 75d6270ca..07f217f5b 100644 --- a/integrations/pinecone/src/haystack_integrations/document_stores/pinecone/document_store.py +++ b/integrations/pinecone/src/haystack_integrations/document_stores/pinecone/document_store.py @@ -11,7 +11,6 @@ from haystack.dataclasses import Document from haystack.document_stores.types import DuplicatePolicy from haystack.utils import Secret, deserialize_secrets_inplace -from haystack.utils.filters import convert from pinecone import Pinecone, PodSpec, ServerlessSpec @@ -201,6 +200,10 @@ 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: + msg = "Invalid filter syntax. See https://docs.haystack.deepset.ai/docs/metadata-filtering for details." + raise ValueError(msg) + # Pinecone only performs vector similarity search # here we are querying with a dummy vector and the max compatible top_k documents = self._embedding_retrieval(query_embedding=self._dummy_vector, filters=filters, top_k=TOP_K_LIMIT) @@ -253,7 +256,8 @@ def _embedding_retrieval( raise ValueError(msg) if filters and "operator" not in filters and "conditions" not in filters: - filters = convert(filters) + msg = "Legacy filters support has been removed. Please see documentation for new filter syntax." + raise ValueError(msg) filters = _normalize_filters(filters) if filters else None result = self.index.query(