From 6fe7213b6f6facc5d9a04ba4d5e30041e0c0ec9a Mon Sep 17 00:00:00 2001 From: vikingowl Date: Sat, 28 Mar 2026 11:34:26 +0100 Subject: [PATCH] fix(core): group auto-detect plugin results together in ranking Calculator and converter results now get a 10k grouping bonus so all their results stay together above websearch/filesearch. Previously websearch (priority 9000) would interleave with converter results (9000, 8999, 8998...) since they had the same base priority. --- crates/owlry-core/src/providers/mod.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/crates/owlry-core/src/providers/mod.rs b/crates/owlry-core/src/providers/mod.rs index 9fc9025..f4a36f2 100644 --- a/crates/owlry-core/src/providers/mod.rs +++ b/crates/owlry-core/src/providers/mod.rs @@ -602,8 +602,20 @@ impl ProviderManager { let dynamic_results = provider.query(query); // Priority comes from plugin-declared priority field let base_score = provider.priority() as i64; + + // Auto-detect plugins (calc, conv) get a grouping bonus so + // all their results stay together above generic search results + let grouping_bonus: i64 = match provider.provider_type() { + ProviderType::Plugin(ref id) + if matches!(id.as_str(), "calc" | "conv") => + { + 10_000 + } + _ => 0, + }; + for (idx, item) in dynamic_results.into_iter().enumerate() { - results.push((item, base_score - idx as i64)); + results.push((item, base_score + grouping_bonus - idx as i64)); } } }