I am using Faiss Document store. When I call get_document_count function along with filters, it is returning zero
Can you please provide a reproducible code example?
from haystack.document_stores import FAISSDocumentStore document_store = FAISSDocumentStore( sql_url="sqlite:///c:/py/faiss_document_store.db" )
Adding documents with content and metadata
documents = [ { "content": "This is the first document about machine learning.", "meta": { "title": "Document1", "author": "AuthorA", "date": "2024-01-01" } }, { "content": "This is the second document about deep learning.", "meta": { "title": "Document2", "author": "AuthorB", "date": "2024-01-02" } }, { "content": "This document discusses natural language processing.", "meta": { "title": "Document3", "author": "AuthorA", "date": "2024-01-03" } } ]
document_store.write_documents(documents)
filters={"author": {"$eq": "AuthorA"}}
print(document_store.get_document_count(filters=filters)) #It is returing 0 --Incorrect
print(len(document_store.get_all_documents(filters=filters))) #It is returing 2 --Correct
I can confirm the bug.
I don't know if we will work on fixing this as it seems relatively minor and affects 1.x (which is maintenance mode). We're concentrating our efforts on Haystack 2.x.
@Srimathi10 Have you considered switching to Haystack version 2.x and using one of the many other DocumentStores we have available in the most recent version of Haystack?
Closing as won't fix in Haystack version 1.x. Please switch to version 2.x.