Find answers from the community

Updated 2 months ago

Delete Documents from Index

Is it possible to delete documents using doc_id from document summary index? I'm having trouble using the summary_index.delete_ref_doc(doc_id, delete_from_docstore=True) method, it raises an exception: Error: node_id 68d98611-0825-4ff5-955f-0c63ac573c98 not in index.
W
a
L
4 comments
Can you check if the particular doc_id that you are trying to delete exists or not?
It exists. I think the document summary index implementation of the _delete_node is incorrect. Here is the relevant snippet: def _delete_node(self, node_id: str, **delete_kwargs: Any) -> None:
"""Delete a node."""
if node_id not in self._index_struct.doc_id_to_summary_id:
raise ValueError(f"node_id {node_id} not in index")
summary_id = self._index_struct.doc_id_to_summary_id[node_id]

# delete summary node from docstore
self.docstore.delete_document(summary_id)

# delete from index struct
self._index_struct.delete(node_id)
@Logan M could you take a look at this. Thanks πŸ™Œ
Yea I'd have to look into it, likely a bug
Add a reply
Sign up and join the conversation on Discord