perf: remove totally redundant and highly allocating .to_lowercase() calls from search endpoints

This commit is contained in:
Riz Ashraf committed 2026-09-21 15:33:35 +01:00
1 parent 9476bcd649
commit f8d98a77fd
3 files changed
+5 -5

No files matched your search

+3 -3
View File
@@ -68,7 +68,7 @@ impl McpTool for QueryDecisionsHandler {
let data = state.adrs.read_with(|adrs| {
let filtered: Vec<_> = adrs.iter().filter(|a| {
if let Some(q) = &req.query {
let q = q.to_lowercase();
let q = q;
contains_ignore_ascii_case(&a.title, &q)
|| contains_ignore_ascii_case(&a.context, &q)
|| contains_ignore_ascii_case(&a.decision, &q)
@@ -129,7 +129,7 @@ impl McpTool for SearchErrorFixesHandler {
async fn execute(&self, args: Value, state: Arc<MemoryState>) -> Result<String, String> {
let req: SearchErrorFixesTool = serde_json::from_value(args).map_err(|e| e.to_string())?;
let q = req.query.to_lowercase();
let q = req.query;
let data = state.error_fixes.read_with(|fixes| {
let filtered: Vec<_> = fixes.iter().filter(|f| {
contains_ignore_ascii_case(&f.signature, &q)
@@ -399,7 +399,7 @@ impl McpTool for OmniSearchHandler {
}
});
let q = req.query.to_lowercase();
let q = req.query;
let tech_debts = state.tech_debts.read_with(|debts| {
debts.iter().filter(|d| {
req.namespace.as_ref().is_none_or(|ns| d.namespace == *ns)