fix: file limiting in docstore

This commit is contained in:
Tadashi
2024-12-25 16:13:43 +07:00
parent 3aa59bdc9b
commit 602aba5bc7

View File

@@ -177,7 +177,11 @@ class VectorRetrieval(BaseRetrieval):
]
elif self.retrieval_mode == "text":
query = text.text if isinstance(text, Document) else text
docs = self.doc_store.query(query, top_k=top_k_first_round, doc_ids=scope)
docs = []
if scope:
docs = self.doc_store.query(
query, top_k=top_k_first_round, doc_ids=scope
)
result = [RetrievedDocument(**doc.to_dict(), score=-1.0) for doc in docs]
elif self.retrieval_mode == "hybrid":
# similarity search section
@@ -206,9 +210,10 @@ class VectorRetrieval(BaseRetrieval):
assert self.doc_store is not None
query = text.text if isinstance(text, Document) else text
ds_docs = self.doc_store.query(
query, top_k=top_k_first_round, doc_ids=scope
)
if scope:
ds_docs = self.doc_store.query(
query, top_k=top_k_first_round, doc_ids=scope
)
vs_query_thread = threading.Thread(target=query_vectorstore)
ds_query_thread = threading.Thread(target=query_docstore)