Skip to content

web search done right

remove bm25+ again

Mikkel Denker1bcf74ec1168
diff --git a/crates/core/src/ranking/bm25.rs b/crates/core/src/ranking/bm25.rs
index 356a41e2..7b40caef 100644
--- a/crates/core/src/ranking/bm25.rs
+++ b/crates/core/src/ranking/bm25.rs
@@ -7,7 +7,6 @@ use tantivy::{Score, Searcher, Term};
pub const K1: Score = 1.2;
pub const B: Score = 0.75;
-pub const DELTA: Score = 1.0;
pub fn idf(doc_freq: u64, doc_count: u64) -> Score {
assert!(doc_count >= doc_freq, "{doc_count} >= {doc_freq}");
@@ -111,7 +110,7 @@ impl Bm25Weight {
#[inline]
pub fn score(&self, fieldnorm_id: u8, term_freq: u32) -> Score {
- self.weight * (self.tf_factor(fieldnorm_id, term_freq) + DELTA)
+ self.weight * self.tf_factor(fieldnorm_id, term_freq)
}
#[inline]
diff --git a/crates/core/src/ranking/bm25f.rs b/crates/core/src/ranking/bm25f.rs
index 0e2961eb..c9095062 100644
--- a/crates/core/src/ranking/bm25f.rs
+++ b/crates/core/src/ranking/bm25f.rs
@@ -17,7 +17,7 @@
use itertools::Itertools;
use tantivy::{Score, Searcher, Term};
-use super::bm25::{compute_tf_cache, idf, DELTA, K1};
+use super::bm25::{compute_tf_cache, idf, K1};
/// A BM25F weight that uses the same IDF weight for all fields.
/// The idea is that the term 'the' might not appear very frequently e.g. in the title field,
@@ -126,7 +126,7 @@ impl Bm25FWeight {
#[inline]
pub fn score(&self, coefficient: Score, fieldnorm_id: u8, term_freq: u32) -> Score {
- self.weight * (self.tf_factor(coefficient, fieldnorm_id, term_freq) + DELTA)
+ self.weight * (self.tf_factor(coefficient, fieldnorm_id, term_freq))
}
#[inline]
diff --git a/crates/core/src/ranking/signal/text.rs b/crates/core/src/ranking/signal/text.rs
index ee698a7a..5050d39a 100644
--- a/crates/core/src/ranking/signal/text.rs
+++ b/crates/core/src/ranking/signal/text.rs
@@ -35,7 +35,7 @@ use super::{Signal, SignalComputer};
pub struct Bm25F;
impl Signal for Bm25F {
fn default_coefficient(&self) -> f64 {
- 0.002
+ 0.1
}
fn as_field(&self) -> Option<Field> {