refactor: remove redundant multi-line search index unwrap clones across all handlers via new get_search_index accessor

This commit is contained in:
Riz Ashraf committed 2026-09-26 08:39:42 +01:00
1 parent d96b4cf822
commit 0ba0ed5b3d
5 files changed
+12 -36

No files matched your search

+2 -10
View File
@@ -126,11 +126,7 @@ impl McpTool for CreateEntitiesHandler {
}
}
});
let idx = state
.search_index
.read()
.unwrap_or_else(|e| e.into_inner())
.clone();
let idx = state.get_search_index();
for entity in inserted {
drop(idx.index_entity(&entity));
}
@@ -237,11 +233,7 @@ impl McpTool for DeleteEntitiesHandler {
return Err(format!("Error: Entities not found: {}", missing.join(", ")));
}
let idx = state
.search_index
.read()
.unwrap_or_else(|e| e.into_inner())
.clone();
let idx = state.get_search_index();
for name in to_delete {
drop(idx.delete_document(&name));
}