aboutsummaryrefslogtreecommitdiffstats
path: root/crates/turtle/src/atuin_daemon/search
diff options
context:
space:
mode:
Diffstat (limited to 'crates/turtle/src/atuin_daemon/search')
-rw-r--r--crates/turtle/src/atuin_daemon/search/mod.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/turtle/src/atuin_daemon/search/mod.rs b/crates/turtle/src/atuin_daemon/search/mod.rs
index 60d923cd..04beb459 100644
--- a/crates/turtle/src/atuin_daemon/search/mod.rs
+++ b/crates/turtle/src/atuin_daemon/search/mod.rs
@@ -93,7 +93,7 @@ impl FrecencyData {
let frequency_score = (f64::from(self.count).ln() * 20.0).min(100.0);
// Apply multipliers and combine scores, then round to u32
- ((recency_score * recency_mul) + (frequency_score * frequency_mul)).round() as u32
+ recency_score.mul_add(recency_mul, frequency_score * frequency_mul).round() as u32
}
}
@@ -261,8 +261,8 @@ type FrecencyMap = Arc<HashMap<Arc<str>, u32>>;
/// although this should never happen due to precomputing the frecency map.
pub(crate) struct SearchIndex {
/// Map from command text to command data.
- /// Using DashMap for concurrent read/write access, wrapped in Arc for sharing with scorer.
- /// Keys are Arc<str> to enable zero-copy sharing with frecency_map.
+ /// Using `DashMap` for concurrent read/write access, wrapped in Arc for sharing with scorer.
+ /// Keys are Arc<str> to enable zero-copy sharing with `frecency_map`.
commands: Arc<DashMap<Arc<str>, CommandData>>,
/// Nucleo fuzzy matcher - items are command strings.
nucleo: RwLock<Nucleo<String>>,
@@ -416,7 +416,7 @@ impl SearchIndex {
.global_frecency
.compute(now, recency_mul, frequency_mul);
// Apply overall frecency multiplier and round to u32
- let frecency = (frecency as f64 * frecency_mul).round() as u32;
+ let frecency = (f64::from(frecency) * frecency_mul).round() as u32;
// Arc::clone is cheap - just increments reference count
frecency_map.insert(Arc::clone(entry.key()), frecency);
}