@@ -64,13 +64,13 @@ def add(self, path: str, recursive: bool = False) -> int:
6464
6565 exists = self ._repository .document_exists_by_hash (document .hash ())
6666 if exists :
67- self ._logger .info (f"Unchanged document : { file_path } " )
67+ self ._logger .info (f"Unchanged: { file_path } " )
6868 continue
6969
70+ self ._logger .info (f"Processing: { file_path } " )
7071 document = self ._engine .process (document )
7172
7273 self ._repository .add_document (document )
73- self ._logger .info (str (file_path ))
7474
7575 if self .settings .quantize_scan :
7676 self ._engine .quantize ()
@@ -108,10 +108,10 @@ def remove_document(self, identifier: str) -> bool:
108108
109109 # First find the document to get its ID
110110 document = self ._repository .find_document_by_id_or_uri (identifier )
111- if not document :
111+ if not document or not document . id :
112112 return False
113113
114- return self ._repository .remove_document (document .id or "" )
114+ return self ._repository .remove_document (document .id )
115115
116116 def rebuild (self , remove_missing : bool = False ) -> dict :
117117 """Rebuild embeddings and full-text index for all documents"""
@@ -124,13 +124,15 @@ def rebuild(self, remove_missing: bool = False) -> dict:
124124 removed = 0
125125
126126 for doc in documents :
127+ doc_id = doc .id or ""
128+
127129 if doc .uri and Path (doc .uri ).exists ():
128130 # File still exists, recreate embeddings
129131 try :
130132 content = FileReader .parse_file (Path (doc .uri ))
131133 doc .content = content
132134
133- self ._repository .remove_document (doc . id or "" )
135+ self ._repository .remove_document (doc_id )
134136 processed_doc = self ._engine .process (doc )
135137 self ._repository .add_document (processed_doc )
136138
@@ -151,7 +153,7 @@ def rebuild(self, remove_missing: bool = False) -> dict:
151153 else :
152154 # Document without URI (text content)
153155 try :
154- self ._repository .remove_document (doc . id or "" )
156+ self ._repository .remove_document (doc_id )
155157 processed_doc = self ._engine .process (doc )
156158 self ._repository .add_document (processed_doc )
157159
0 commit comments