web search done right
simplified bm25f that uses same IDF weight across all fields
Mikkel Denker5beae3b9a9cd
diff --git a/crates/core/src/ranking/bitvec_similarity.rs b/crates/core/src/ranking/bitvec_similarity.rsindex 3a8468b8..ac393c71 100644--- a/crates/core/src/ranking/bitvec_similarity.rs+++ b/crates/core/src/ranking/bitvec_similarity.rs@@ -1,5 +1,5 @@// Stract is an open source web search engine.-// Copyright (C) 2023 Stract ApS+// Copyright (C) 2024 Stract ApS//// This program is free software: you can redistribute it and/or modify// it under the terms of the GNU Affero General Public License asdiff --git a/crates/core/src/ranking/bm25.rs b/crates/core/src/ranking/bm25.rsindex f1cede25..356a41e2 100644--- a/crates/core/src/ranking/bm25.rs+++ b/crates/core/src/ranking/bm25.rs@@ -3,14 +3,13 @@use itertools::Itertools;use tantivy::fieldnorm::FieldNormReader;-use tantivy::query::Explanation;use tantivy::{Score, Searcher, Term};-const K1: Score = 1.2;-const B: Score = 0.75;-const DELTA: Score = 1.0;+pub const K1: Score = 1.2;+pub const B: Score = 0.75;+pub const DELTA: Score = 1.0;-pub(crate) fn idf(doc_freq: u64, doc_count: u64) -> Score {+pub fn idf(doc_freq: u64, doc_count: u64) -> Score {assert!(doc_count >= doc_freq, "{doc_count} >= {doc_freq}");let x = ((doc_count - doc_freq) as Score + 0.5) / (doc_freq as Score + 0.5);(1.0 + x).ln()@@ -20,7 +19,7 @@ fn cached_tf_component(fieldnorm: u32, average_fieldnorm: Score) -> Score {K1 * (1.0 - B + B * fieldnorm as Score / average_fieldnorm)}-fn compute_tf_cache(average_fieldnorm: Score) -> [Score; 256] {+pub fn compute_tf_cache(average_fieldnorm: Score) -> [Score; 256] {let mut cache: [Score; 256] = [0.0; 256];for (fieldnorm_id, cache_mut) in cache.iter_mut().enumerate() {let fieldnorm = FieldNormReader::id_to_fieldnorm(fieldnorm_id as u8);@@ -29,14 +28,6 @@ fn compute_tf_cache(average_fieldnorm: Score) -> [Score; 256] {cache}-#[derive(- Clone, PartialEq, Debug, serde::Serialize, serde::Deserialize, bincode::Encode, bincode::Decode,-)]-pub struct Bm25Params {- pub idf: Score,- pub avg_fieldnorm: Score,-}-#[derive(Clone)]pub struct MultiBm25Weight {weights: Vec<Bm25Weight>,@@ -93,55 +84,28 @@ impl MultiBm25Weight {pub fn idf(&self) -> impl Iterator<Item = f32> + '_ {self.weights.iter().map(|w| w.weight)}-- pub fn boost_by(&self, boost: Score) -> Self {- Self {- weights: self.weights.iter().map(|w| w.boost_by(boost)).collect(),- }- }}#[derive(Clone)]pub struct Bm25Weight {- idf_explain: Explanation,weight: Score,cache: [Score; 256],- average_fieldnorm: Score,}impl Bm25Weight {- pub fn boost_by(&self, boost: Score) -> Bm25Weight {- Bm25Weight {- idf_explain: self.idf_explain.clone(),- weight: self.weight * boost,- cache: self.cache,- average_fieldnorm: self.average_fieldnorm,- }- }-pub fn for_one_term(term_doc_freq: u64,total_num_docs: u64,avg_fieldnorm: Score,) -> Bm25Weight {let idf = idf(term_doc_freq, total_num_docs);- let mut idf_explain =- Explanation::new("idf, computed as log(1 + (N - n + 0.5) / (n + 0.5))", idf);- idf_explain.add_const(- "n, number of docs containing this term",- term_doc_freq as Score,- );- idf_explain.add_const("N, total number of docs", total_num_docs as Score);- Bm25Weight::new(idf_explain, avg_fieldnorm)+ Bm25Weight::new(idf, avg_fieldnorm)}- pub(crate) fn new(idf_explain: Explanation, average_fieldnorm: Score) -> Bm25Weight {- let weight = idf_explain.value();+ pub fn new(weight: Score, average_fieldnorm: Score) -> Bm25Weight {Bm25Weight {- idf_explain,weight,cache: compute_tf_cache(average_fieldnorm),- average_fieldnorm,}}@@ -151,41 +115,11 @@ impl Bm25Weight {}#[inline]- pub(crate) fn tf_factor(&self, fieldnorm_id: u8, term_freq: u32) -> Score {+ pub fn tf_factor(&self, fieldnorm_id: u8, term_freq: u32) -> Score {let term_freq = term_freq as Score;let norm = self.cache[fieldnorm_id as usize];(term_freq * (K1 + 1.0)) / (term_freq + norm)}-- pub fn explain(&self, fieldnorm_id: u8, term_freq: u32) -> Explanation {- // The explain format is directly copied from Lucene's.- // (So, Kudos to Lucene)- let score = self.score(fieldnorm_id, term_freq);-- let norm = self.cache[fieldnorm_id as usize];- let term_freq = term_freq as Score;- let right_factor = term_freq / (term_freq + norm);-- let mut tf_explanation = Explanation::new(- "freq / (freq + k1 * (1 - b + b * dl / avgdl))",- right_factor,- );-- tf_explanation.add_const("freq, occurrences of term within document", term_freq);- tf_explanation.add_const("k1, term saturation parameter", K1);- tf_explanation.add_const("b, length normalization parameter", B);- tf_explanation.add_const(- "dl, length of field",- FieldNormReader::id_to_fieldnorm(fieldnorm_id) as Score,- );- tf_explanation.add_const("avgdl, average length of field", self.average_fieldnorm);-- let mut explanation = Explanation::new("TermQuery, product of...", score);- explanation.add_detail(Explanation::new("(K1+1)", K1 + 1.0));- explanation.add_detail(self.idf_explain.clone());- explanation.add_detail(tf_explanation);- explanation- }}#[cfg(test)]diff --git a/crates/core/src/ranking/bm25f.rs b/crates/core/src/ranking/bm25f.rsnew file mode 100644index 00000000..0e2961eb--- /dev/null+++ b/crates/core/src/ranking/bm25f.rs@@ -0,0 +1,138 @@+// Stract is an open source web search engine.+// Copyright (C) 2024 Stract ApS+//+// This program is free software: you can redistribute it and/or modify+// it under the terms of the GNU Affero General Public License as+// published by the Free Software Foundation, either version 3 of the+// License, or (at your option) any later version.+//+// This program is distributed in the hope that it will be useful,+// but WITHOUT ANY WARRANTY; without even the implied warranty of+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+// GNU Affero General Public License for more details.+//+// You should have received a copy of the GNU Affero General Public License+// along with this program. If not, see <https://www.gnu.org/licenses/>.++use itertools::Itertools;+use tantivy::{Score, Searcher, Term};++use super::bm25::{compute_tf_cache, idf, DELTA, 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,+/// but it should still be considered a common term.+///+/// Note that this is a simplification of the BM25F algorithm+/// and not a direct implementation of the paper.+/// The main difference lies in the fact that the paper sums the TF component+/// across all fields for each term before multiplying it with the IDF component.+/// The way we iterate over the fields during ranking makes this approach infeasible+/// and we simply take the main idea of re-using the same IDF weight for all fields instead.+///+/// Papers:+/// https://trec.nist.gov/pubs/trec13/papers/microsoft-cambridge.web.hard.pdf+/// http://www.staff.city.ac.uk/~sbrp622/papers/foundations_bm25_review.pdf+#[derive(Clone)]+pub struct MultiBm25FWeight {+ weights: Vec<Bm25FWeight>,+}++impl MultiBm25FWeight {+ pub fn for_terms(searcher: &Searcher, terms: &[Term]) -> Self {+ if terms.is_empty() {+ return Self {+ weights: Vec::new(),+ };+ }++ let field = terms[0].field();+ for term in terms.iter().skip(1) {+ assert_eq!(+ term.field(),+ field,+ "All terms must belong to the same field."+ );+ }++ let mut total_num_tokens = 0u64;+ let mut total_num_docs = 0u64;++ for segment_reader in searcher.segment_readers() {+ let inverted_index = segment_reader.inverted_index(field).unwrap();+ total_num_tokens += inverted_index.total_num_tokens();+ total_num_docs += u64::from(segment_reader.max_doc());+ }++ let average_fieldnorm = total_num_tokens as f32 / total_num_docs as f32;++ let mut weights = Vec::new();++ for term in terms {+ // use highest freq as an approximation of the term doc freq across all fields+ let term_doc_freq = searcher+ .schema()+ .fields()+ .filter_map(|(field, _)| {+ let term = Term::from_field_text(field, term.value().as_str().unwrap());+ searcher.doc_freq(&term).ok()+ })+ .max()+ .unwrap_or_default();++ weights.push(Bm25FWeight::for_one_term(+ term_doc_freq,+ total_num_docs,+ average_fieldnorm,+ ));+ }++ Self { weights }+ }++ #[inline]+ pub fn score(&self, coefficient: Score, stats: impl Iterator<Item = (u8, u32)>) -> Score {+ stats+ .zip_eq(self.weights.iter())+ .map(|((fieldnorm_id, term_freq), weight)| {+ weight.score(coefficient, fieldnorm_id, term_freq)+ })+ .sum()+ }+}++#[derive(Clone)]+pub struct Bm25FWeight {+ weight: Score,+ cache: [Score; 256],+}++impl Bm25FWeight {+ pub fn for_one_term(+ term_doc_freq: u64,+ total_num_docs: u64,+ avg_fieldnorm: Score,+ ) -> Bm25FWeight {+ let idf = idf(term_doc_freq, total_num_docs);+ Bm25FWeight::new(idf, avg_fieldnorm)+ }++ pub fn new(weight: Score, average_fieldnorm: Score) -> Bm25FWeight {+ Bm25FWeight {+ weight,+ cache: compute_tf_cache(average_fieldnorm),+ }+ }++ #[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)+ }++ #[inline]+ pub fn tf_factor(&self, coefficient: Score, fieldnorm_id: u8, term_freq: u32) -> Score {+ let term_freq = term_freq as Score * coefficient;+ let norm = self.cache[fieldnorm_id as usize];+ (term_freq * (K1 + 1.0)) / (term_freq + norm)+ }+}diff --git a/crates/core/src/ranking/mod.rs b/crates/core/src/ranking/mod.rsindex adb0d1a6..f2950901 100644--- a/crates/core/src/ranking/mod.rs+++ b/crates/core/src/ranking/mod.rs@@ -16,6 +16,7 @@pub mod bitvec_similarity;pub mod bm25;+pub mod bm25f;pub mod inbound_similarity;pub mod initial;pub mod models;diff --git a/crates/core/src/ranking/signal/computer/mod.rs b/crates/core/src/ranking/signal/computer/mod.rsindex 73affc26..1f2f06e1 100644--- a/crates/core/src/ranking/signal/computer/mod.rs+++ b/crates/core/src/ranking/signal/computer/mod.rs@@ -16,6 +16,7 @@use crate::query::optic::AsSearchableRule;use crate::query::{Query, MAX_TERMS_FOR_NGRAM_LOOKUPS};+use crate::ranking::bm25f::MultiBm25FWeight;use crate::schema::text_field::TextField;use crate::Result;use crate::{enum_map::EnumMap, fastfield_reader, schema::TextFieldEnum, webpage::Webpage};@@ -24,13 +25,14 @@ use std::cell::RefCell;use std::sync::Arc;+use itertools::Itertools;use tantivy::fieldnorm::FieldNormReader;use tantivy::postings::SegmentPostings;use tantivy::query::{Query as _, Scorer};use tantivy::tokenizer::Tokenizer as _;-use tantivy::DocId;use tantivy::DocSet;+use tantivy::{DocId, Postings};use crate::webpage::region::RegionCount;@@ -44,11 +46,69 @@ pub use order::SignalComputeOrder;#[derive(Clone)]pub struct TextFieldData {- pub(super) postings: Vec<SegmentPostings>,- pub(super) weight: MultiBm25Weight,- pub(super) fieldnorm_reader: FieldNormReader,+ postings: Vec<SegmentPostings>,+ bm25: MultiBm25Weight,+ bm25f: MultiBm25FWeight,+ fieldnorm_reader: FieldNormReader,+ signal_coefficient: f64,}+impl TextFieldData {+ pub fn bm25(&mut self, doc: DocId) -> f64 {+ if self.postings.is_empty() {+ return 0.0;+ }++ let fieldnorm_id = self.fieldnorm_reader.fieldnorm_id(doc);++ self.bm25+ .score(self.postings.iter_mut().map(move |posting| {+ if posting.doc() == doc || (posting.doc() < doc && posting.seek(doc) == doc) {+ (fieldnorm_id, posting.term_freq())+ } else {+ (fieldnorm_id, 0)+ }+ })) as f64+ }++ pub fn idf_sum(&mut self, doc: DocId) -> f64 {+ if self.postings.is_empty() {+ return 0.0;+ }+ let idf = self.bm25.idf();++ self.postings+ .iter_mut()+ .zip_eq(idf)+ .filter_map(|(posting, idf)| {+ if posting.doc() == doc || (posting.doc() < doc && posting.seek(doc) == doc) {+ Some(idf)+ } else {+ None+ }+ })+ .sum::<f32>() as f64+ }++ pub fn bm25f(&mut self, doc: DocId) -> f64 {+ if self.postings.is_empty() {+ return 0.0;+ }++ let fieldnorm_id = self.fieldnorm_reader.fieldnorm_id(doc);++ self.bm25f.score(+ self.signal_coefficient as f32,+ self.postings.iter_mut().map(move |posting| {+ if posting.doc() == doc || (posting.doc() < doc && posting.seek(doc) == doc) {+ (fieldnorm_id, posting.term_freq())+ } else {+ (fieldnorm_id, 0)+ }+ }),+ ) as f64+ }+}pub struct RuleBoost {docset: Box<dyn Scorer>,boost: f64,@@ -229,14 +289,17 @@ impl SignalComputer {matching_terms.push(term.clone());}}- let weight = MultiBm25Weight::for_terms(tv_searcher, &matching_terms)?;+ let bm25 = MultiBm25Weight::for_terms(tv_searcher, &matching_terms)?;+ let bm25f = MultiBm25FWeight::for_terms(tv_searcher, &matching_terms);text_fields.insert(text_field,TextFieldData {postings,- weight,+ bm25,+ bm25f,fieldnorm_reader,+ signal_coefficient: self.coefficient(&signal),},);}diff --git a/crates/core/src/ranking/signal/prelude.rs b/crates/core/src/ranking/signal/prelude.rsindex 64d13c4d..5c639d21 100644--- a/crates/core/src/ranking/signal/prelude.rs+++ b/crates/core/src/ranking/signal/prelude.rs@@ -78,6 +78,7 @@ pub trait Signal:))]#[strum_discriminants(serde(rename_all = "snake_case"))]pub enum SignalEnum {+ Bm25F,Bm25Title,Bm25TitleBigrams,Bm25TitleTrigrams,@@ -122,6 +123,7 @@ pub enum SignalEnum {enum_dispatch_from_discriminant!(SignalEnumDiscriminants => SignalEnum,[+ Bm25F,Bm25Title,Bm25TitleBigrams,Bm25TitleTrigrams,diff --git a/crates/core/src/ranking/signal/text.rs b/crates/core/src/ranking/signal/text.rsindex 282d38b3..ee698a7a 100644--- a/crates/core/src/ranking/signal/text.rs+++ b/crates/core/src/ranking/signal/text.rs@@ -15,50 +15,44 @@// along with this program. If not, see <https://www.gnu.org/licenses/>use crate::schema::{self, Field};-use itertools::Itertools;-use tantivy::DocSet;-use tantivy::{DocId, Postings};+use tantivy::DocId;-use super::computer::TextFieldData;use super::{Signal, SignalComputer};-fn bm25(field: &mut TextFieldData, doc: DocId) -> f64 {- if field.postings.is_empty() {- return 0.0;+#[derive(+ Debug,+ Clone,+ Copy,+ PartialEq,+ Eq,+ Hash,+ serde::Serialize,+ serde::Deserialize,+ bincode::Encode,+ bincode::Decode,+)]+pub struct Bm25F;+impl Signal for Bm25F {+ fn default_coefficient(&self) -> f64 {+ 0.002}- let fieldnorm_id = field.fieldnorm_reader.fieldnorm_id(doc);+ fn as_field(&self) -> Option<Field> {+ None+ }- field- .weight- .score(field.postings.iter_mut().map(move |posting| {- if posting.doc() == doc || (posting.doc() < doc && posting.seek(doc) == doc) {- (fieldnorm_id, posting.term_freq())- } else {- (fieldnorm_id, 0)- }- })) as f64-}+ fn compute(&self, doc: DocId, signal_computer: &SignalComputer) -> Option<f64> {+ let mut seg_reader = signal_computer.segment_reader().unwrap().borrow_mut();-fn idf_sum(field: &mut TextFieldData, doc: DocId) -> f64 {- if field.postings.is_empty() {- return 0.0;- }- let idf = field.weight.idf();-- field- .postings- .iter_mut()- .zip_eq(idf)- .filter_map(|(posting, idf)| {- if posting.doc() == doc || (posting.doc() < doc && posting.seek(doc) == doc) {- Some(idf)- } else {- None- }- })- .sum::<f32>() as f64+ Some(+ seg_reader+ .text_fields_mut()+ .values_mut()+ .map(|field| field.bm25f(doc))+ .sum(),+ )+ }}#[derive(@@ -89,7 +83,7 @@ impl Signal for Bm25Title {seg_reader.text_fields_mut().get_mut(self.as_textfield().unwrap())- .map(|field| bm25(field, doc))+ .map(|field| field.bm25(doc))}}@@ -121,7 +115,7 @@ impl Signal for Bm25TitleBigrams {seg_reader.text_fields_mut().get_mut(self.as_textfield().unwrap())- .map(|field| bm25(field, doc))+ .map(|field| field.bm25(doc))}}@@ -153,7 +147,7 @@ impl Signal for Bm25TitleTrigrams {seg_reader.text_fields_mut().get_mut(self.as_textfield().unwrap())- .map(|field| bm25(field, doc))+ .map(|field| field.bm25(doc))}}@@ -185,7 +179,7 @@ impl Signal for Bm25CleanBody {seg_reader.text_fields_mut().get_mut(self.as_textfield().unwrap())- .map(|field| bm25(field, doc))+ .map(|field| field.bm25(doc))}}@@ -217,7 +211,7 @@ impl Signal for Bm25CleanBodyBigrams {seg_reader.text_fields_mut().get_mut(self.as_textfield().unwrap())- .map(|field| bm25(field, doc))+ .map(|field| field.bm25(doc))}}@@ -249,7 +243,7 @@ impl Signal for Bm25CleanBodyTrigrams {seg_reader.text_fields_mut().get_mut(self.as_textfield().unwrap())- .map(|field| bm25(field, doc))+ .map(|field| field.bm25(doc))}}@@ -281,7 +275,7 @@ impl Signal for Bm25StemmedTitle {seg_reader.text_fields_mut().get_mut(self.as_textfield().unwrap())- .map(|field| bm25(field, doc))+ .map(|field| field.bm25(doc))}}@@ -313,7 +307,7 @@ impl Signal for Bm25StemmedCleanBody {seg_reader.text_fields_mut().get_mut(self.as_textfield().unwrap())- .map(|field| bm25(field, doc))+ .map(|field| field.bm25(doc))}}@@ -345,7 +339,7 @@ impl Signal for Bm25AllBody {seg_reader.text_fields_mut().get_mut(self.as_textfield().unwrap())- .map(|field| bm25(field, doc))+ .map(|field| field.bm25(doc))}}@@ -377,7 +371,7 @@ impl Signal for Bm25Keywords {seg_reader.text_fields_mut().get_mut(self.as_textfield().unwrap())- .map(|field| bm25(field, doc))+ .map(|field| field.bm25(doc))}}@@ -409,7 +403,7 @@ impl Signal for Bm25BacklinkText {seg_reader.text_fields_mut().get_mut(self.as_textfield().unwrap())- .map(|field| bm25(field, doc))+ .map(|field| field.bm25(doc))}}@@ -441,7 +435,7 @@ impl Signal for IdfSumUrl {seg_reader.text_fields_mut().get_mut(self.as_textfield().unwrap())- .map(|field| idf_sum(field, doc))+ .map(|field| field.idf_sum(doc))}}@@ -473,7 +467,7 @@ impl Signal for IdfSumSite {seg_reader.text_fields_mut().get_mut(self.as_textfield().unwrap())- .map(|field| idf_sum(field, doc))+ .map(|field| field.idf_sum(doc))}}@@ -505,7 +499,7 @@ impl Signal for IdfSumDomain {seg_reader.text_fields_mut().get_mut(self.as_textfield().unwrap())- .map(|field| idf_sum(field, doc))+ .map(|field| field.idf_sum(doc))}}@@ -537,7 +531,7 @@ impl Signal for IdfSumSiteNoTokenizer {seg_reader.text_fields_mut().get_mut(self.as_textfield().unwrap())- .map(|field| idf_sum(field, doc))+ .map(|field| field.idf_sum(doc))}}@@ -569,7 +563,7 @@ impl Signal for IdfSumDomainNoTokenizer {seg_reader.text_fields_mut().get_mut(self.as_textfield().unwrap())- .map(|field| idf_sum(field, doc))+ .map(|field| field.idf_sum(doc))}}@@ -603,7 +597,7 @@ impl Signal for IdfSumDomainNameNoTokenizer {seg_reader.text_fields_mut().get_mut(self.as_textfield().unwrap())- .map(|field| idf_sum(field, doc))+ .map(|field| field.idf_sum(doc))}}@@ -635,7 +629,7 @@ impl Signal for IdfSumDomainIfHomepage {seg_reader.text_fields_mut().get_mut(self.as_textfield().unwrap())- .map(|field| idf_sum(field, doc))+ .map(|field| field.idf_sum(doc))}}@@ -669,7 +663,7 @@ impl Signal for IdfSumDomainNameIfHomepageNoTokenizer {seg_reader.text_fields_mut().get_mut(self.as_textfield().unwrap())- .map(|field| idf_sum(field, doc))+ .map(|field| field.idf_sum(doc))}}@@ -703,7 +697,7 @@ impl Signal for IdfSumDomainIfHomepageNoTokenizer {seg_reader.text_fields_mut().get_mut(self.as_textfield().unwrap())- .map(|field| idf_sum(field, doc))+ .map(|field| field.idf_sum(doc))}}@@ -735,7 +729,7 @@ impl Signal for IdfSumTitleIfHomepage {seg_reader.text_fields_mut().get_mut(self.as_textfield().unwrap())- .map(|field| idf_sum(field, doc))+ .map(|field| field.idf_sum(doc))}}diff --git a/frontend/src/lib/api/index.ts b/frontend/src/lib/api/index.tsindex e3ea142b..979a3893 100644--- a/frontend/src/lib/api/index.ts+++ b/frontend/src/lib/api/index.ts@@ -122,13 +122,6 @@ export const api = {requestJson<HighlightedSpellCorrection>('POST', `/beta/api/search/spellcheck`, body, options),searchWidget: (body: WidgetQuery, options?: ApiOptions) =>requestJson<Widget>('POST', `/beta/api/search/widget`, body, options),- summarize: (- query: {- query: string;- url: string;- },- options?: ApiOptions,- ) => sse<string>('GET', `/beta/api/summarize?${new URLSearchParams(query)}`, options),webgraphHostIngoing: (query: {host: string;@@ -378,6 +371,7 @@ export type SidebarQuery = {query: string;};export type SignalEnumDiscriminants =+ | 'bm25_f'| 'bm25_title'| 'bm25_title_bigrams'| 'bm25_title_trigrams'@@ -419,6 +413,7 @@ export type SignalEnumDiscriminants =| 'title_embedding_similarity'| 'keyword_embedding_similarity';export const SIGNAL_ENUM_DISCRIMINANTS = [+ 'bm25_f','bm25_title','bm25_title_bigrams','bm25_title_trigrams',diff --git a/frontend/src/routes/search/Modal.svelte b/frontend/src/routes/search/Modal.svelteindex 9dee7858..f4ba54a3 100644--- a/frontend/src/routes/search/Modal.svelte+++ b/frontend/src/routes/search/Modal.svelte@@ -1,5 +1,6 @@<script context="module" lang="ts">export type SignalLabel =+ | 'combinedText'| 'title'| 'body'| 'keywords'@@ -86,6 +87,7 @@.with('link_density', () => 'linkDensity' as const).with('title_embedding_similarity', () => 'title' as const).with('keyword_embedding_similarity', () => 'keywords' as const)+ .with('bm25_f', () => 'combinedText' as const).exhaustive();};diff --git a/frontend/src/routes/search/SignalInfo.svelte b/frontend/src/routes/search/SignalInfo.svelteindex 6d8c390d..a7f3539a 100644--- a/frontend/src/routes/search/SignalInfo.svelte+++ b/frontend/src/routes/search/SignalInfo.svelte@@ -84,6 +84,10 @@title: 'Link Density',description: 'The page has a low number of links compared to the amount of text',}))+ .with('combinedText', () => ({+ title: 'Combined Text',+ description: 'An overall score of how well the text on the page matches the query',+ })).exhaustive();};</script>