mirror of
https://github.com/deepset-ai/haystack.git
synced 2026-01-08 04:56:45 +00:00
feat: Add warnings to PineconeDocumentStore about indexing metadata if filters return no documents (#3086)
* black-jupyter format changes * fix merge * filters and documents/ids list evaluations fix (for this specific warning context)
This commit is contained in:
parent
f010a17f04
commit
911a2fa7e4
@ -636,6 +636,13 @@ class PineconeDocumentStore(BaseDocumentStore):
|
||||
namespace = self.document_namespace
|
||||
|
||||
ids = self._get_all_document_ids(index=index, namespace=namespace, filters=filters, batch_size=batch_size)
|
||||
|
||||
if filters is not None and len(ids) == 0:
|
||||
logger.warning(
|
||||
"This query might have been done without metadata indexed and thus no DOCUMENTS were retrieved. "
|
||||
"Make sure the desired metadata you want to filter with is indexed."
|
||||
)
|
||||
|
||||
for i in range(0, len(ids), batch_size):
|
||||
i_end = min(len(ids), i + batch_size)
|
||||
documents = self.get_documents_by_id(
|
||||
@ -1127,6 +1134,12 @@ class PineconeDocumentStore(BaseDocumentStore):
|
||||
vector_id_matrix, meta_matrix, values=values, index=index, return_embedding=return_embedding
|
||||
)
|
||||
|
||||
if filters is not None and len(documents) == 0:
|
||||
logger.warning(
|
||||
"This query might have been done without metadata indexed and thus no results were retrieved. "
|
||||
"Make sure the desired metadata you want to filter with is indexed."
|
||||
)
|
||||
|
||||
# assign query score to each document
|
||||
scores_for_vector_ids: Dict[str, float] = {str(v_id): s for v_id, s in zip(vector_id_matrix, score_matrix)}
|
||||
for doc in documents:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user