The community member is trying to fetch document metadata stored in a FAISS index using the LlamaIndex. The comments suggest that FAISS only stores the embedding vector and an ID, and the community member needs to maintain a docstore to link back to the original node with its metadata. Another community member mentions that when embedding multiple PDF documents, the process does not work correctly, but it works when embedding just one document. They also suggest that the documents may be too similar to each other, and FAISS does not support metadata filtering. The community member also mentions that when they try to query, all documents are retrieved instead of just the concerned documents, and they suspect they may have a logic problem.
def query(self, query_text, discussion_id=None): # Load documents from MongoDB and embeddings from FAISS index documents = list(chunks_collection.find({})) if not documents: logging.error("No documents found in the database.") return {"response": "No documents found in the database.", "sources": []}
logging.info(f"Loaded {len(documents)} documents from the database")