diff --git a/lightrag/lightrag.py b/lightrag/lightrag.py index 73716621..9f74c917 100644 --- a/lightrag/lightrag.py +++ b/lightrag/lightrag.py @@ -1264,7 +1264,7 @@ class LightRAG: """ try: # 1. Get the document status and related data - doc_status = await self.doc_status.get(doc_id) + doc_status = await self.doc_status.get_by_id(doc_id) if not doc_status: logger.warning(f"Document {doc_id} not found") return @@ -1272,9 +1272,7 @@ class LightRAG: logger.debug(f"Starting deletion for document {doc_id}") # 2. Get all related chunks - chunks = await self.text_chunks.filter( - lambda x: x.get("full_doc_id") == doc_id - ) + chunks = await self.text_chunks.get_by_id(doc_id) chunk_ids = list(chunks.keys()) logger.debug(f"Found {len(chunk_ids)} chunks to delete") @@ -1410,9 +1408,7 @@ class LightRAG: logger.error(f"Document {doc_id} still exists in full_docs") # Verify if chunks have been deleted - remaining_chunks = await self.text_chunks.filter( - lambda x: x.get("full_doc_id") == doc_id - ) + remaining_chunks = await self.text_chunks.get_by_id(doc_id) if remaining_chunks: logger.error(f"Found {len(remaining_chunks)} remaining chunks")