File tree Expand file tree Collapse file tree 1 file changed +23
-7
lines changed
src/basic_memory/services Expand file tree Collapse file tree 1 file changed +23
-7
lines changed Original file line number Diff line number Diff line change @@ -184,13 +184,29 @@ async def index_entity_data(
184184 entity : Entity ,
185185 content : str | None = None ,
186186 ) -> None :
187- # delete all search index data associated with entity
188- await self .repository .delete_by_entity_id (entity_id = entity .id )
189-
190- # reindex
191- await self .index_entity_markdown (
192- entity , content
193- ) if entity .is_markdown else await self .index_entity_file (entity )
187+ logger .info (
188+ f"[BackgroundTask] Starting search index for entity_id={ entity .id } "
189+ f"permalink={ entity .permalink } project_id={ entity .project_id } "
190+ )
191+ try :
192+ # delete all search index data associated with entity
193+ await self .repository .delete_by_entity_id (entity_id = entity .id )
194+
195+ # reindex
196+ await self .index_entity_markdown (
197+ entity , content
198+ ) if entity .is_markdown else await self .index_entity_file (entity )
199+
200+ logger .info (
201+ f"[BackgroundTask] Completed search index for entity_id={ entity .id } "
202+ f"permalink={ entity .permalink } "
203+ )
204+ except Exception as e :
205+ logger .error (
206+ f"[BackgroundTask] Failed search index for entity_id={ entity .id } "
207+ f"permalink={ entity .permalink } error={ e } "
208+ )
209+ raise
194210
195211 async def index_entity_file (
196212 self ,
You can’t perform that action at this time.
0 commit comments