mirror of
https://github.com/Cinnamon/kotaemon.git
synced 2025-07-03 15:10:16 +00:00
fix(docstore): preserve retrieval ranking order in lancedb get() (#745)
This commit is contained in:
parent
ddb5187293
commit
833982ac81
@ -113,14 +113,17 @@ class LanceDBDocumentStore(BaseDocumentStore):
|
||||
)
|
||||
except (ValueError, FileNotFoundError):
|
||||
docs = []
|
||||
return [
|
||||
Document(
|
||||
id_=doc["id"],
|
||||
|
||||
# return the documents using the order of original ids (which were ordered by score)
|
||||
doc_dict = {
|
||||
doc["id"]: Document(
|
||||
d_=doc["id"],
|
||||
text=doc["text"] if doc["text"] else "<empty>",
|
||||
metadata=json.loads(doc["attributes"]),
|
||||
)
|
||||
for doc in docs
|
||||
]
|
||||
}
|
||||
return [doc_dict[_id] for _id in ids if _id in doc_dict]
|
||||
|
||||
def delete(self, ids: Union[List[str], str], refresh_indices: bool = True):
|
||||
"""Delete document by id"""
|
||||
|
Loading…
x
Reference in New Issue
Block a user