mirror of
https://github.com/Cinnamon/kotaemon.git
synced 2025-07-04 07:26:29 +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):
|
except (ValueError, FileNotFoundError):
|
||||||
docs = []
|
docs = []
|
||||||
return [
|
|
||||||
Document(
|
# return the documents using the order of original ids (which were ordered by score)
|
||||||
id_=doc["id"],
|
doc_dict = {
|
||||||
|
doc["id"]: Document(
|
||||||
|
d_=doc["id"],
|
||||||
text=doc["text"] if doc["text"] else "<empty>",
|
text=doc["text"] if doc["text"] else "<empty>",
|
||||||
metadata=json.loads(doc["attributes"]),
|
metadata=json.loads(doc["attributes"]),
|
||||||
)
|
)
|
||||||
for doc in docs
|
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):
|
def delete(self, ids: Union[List[str], str], refresh_indices: bool = True):
|
||||||
"""Delete document by id"""
|
"""Delete document by id"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user