From c46c65c6eaea923ce0c67abf31f0b2e736908883 Mon Sep 17 00:00:00 2001 From: Marco Forlin Date: Fri, 10 Oct 2025 13:31:30 +0200 Subject: [PATCH 1/2] ranking bugfix --- crates/tabby/src/services/code.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/tabby/src/services/code.rs b/crates/tabby/src/services/code.rs index e9c5963d0b96..309ac58aa1b7 100644 --- a/crates/tabby/src/services/code.rs +++ b/crates/tabby/src/services/code.rs @@ -157,7 +157,7 @@ fn retain_at_most_two_hits_per_file(scored_hits: &mut Vec) { fn compute_rank_score(resp: Vec<(f32, TantivyDocument)>) -> Vec<(f32, f32, TantivyDocument)> { resp.into_iter() .enumerate() - .map(|(rank, (score, doc))| (1.0 / (RANK_CONSTANT + (rank + 1) as f32), score, doc)) + .map(|(_rank, (score, doc))| (1.0 / (RANK_CONSTANT + (score + 1) as f32), score, doc)) .collect() } From 03dcf8715f53099970eabdb2bbd787b967e59d28 Mon Sep 17 00:00:00 2001 From: Marco Forlin Date: Fri, 10 Oct 2025 13:50:09 +0200 Subject: [PATCH 2/2] fix type --- crates/tabby/src/services/code.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/tabby/src/services/code.rs b/crates/tabby/src/services/code.rs index 309ac58aa1b7..c7671d38af8b 100644 --- a/crates/tabby/src/services/code.rs +++ b/crates/tabby/src/services/code.rs @@ -157,7 +157,7 @@ fn retain_at_most_two_hits_per_file(scored_hits: &mut Vec) { fn compute_rank_score(resp: Vec<(f32, TantivyDocument)>) -> Vec<(f32, f32, TantivyDocument)> { resp.into_iter() .enumerate() - .map(|(_rank, (score, doc))| (1.0 / (RANK_CONSTANT + (score + 1) as f32), score, doc)) + .map(|(_rank, (score, doc))| (1.0 / (RANK_CONSTANT + (score + 1.0) as f32), score, doc)) .collect() }