tenseleyflow/gump / 99ab201

Browse files

prioritize fuzzy match quality over frecency

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
99ab201cbe47a77f36061ea988df12bd8647a248
Parents
048dad1
Tree
6b1613d

2 changed files

StatusFile+-
M Cargo.lock 1 1
M src/matcher/fuzzy.rs 7 5
Cargo.lockmodified
@@ -290,7 +290,7 @@ dependencies = [
290290
 
291291
 [[package]]
292292
 name = "gump"
293
-version = "0.2.1"
293
+version = "0.2.2"
294294
 dependencies = [
295295
  "bincode",
296296
  "chrono",
src/matcher/fuzzy.rsmodified
@@ -133,11 +133,13 @@ impl Matcher {
133133
             .filter_map(|(path, frecency)| {
134134
                 let fuzzy_score = self.score(path, terms)?;
135135
 
136
-                // Combined score: frecency is the primary factor, fuzzy score is secondary
137
-                // Frecency typically ranges 0.25-40+, fuzzy score 0-500+
138
-                // We normalize fuzzy score to 0-1 range and use it as a multiplier
139
-                let fuzzy_factor = 1.0 + (fuzzy_score as f64 / 500.0).min(1.0);
140
-                let combined_score = frecency * fuzzy_factor;
136
+                // Combined score: fuzzy match quality is PRIMARY, frecency is secondary
137
+                // This ensures a great match beats a poor match with high frecency
138
+                //
139
+                // Fuzzy score (0-500+) is the base
140
+                // Frecency (0.25-40+) adds a small boost (up to ~25%) for tiebreaking
141
+                let frecency_bonus = 1.0 + (frecency / 160.0).min(0.25);
142
+                let combined_score = (fuzzy_score as f64) * frecency_bonus;
141143
 
142144
                 Some(Match {
143145
                     path,