web search done right
boost title field matches in entity index
Mikkel Denker045d5d4b0579
diff --git a/crates/core/src/entity_index/mod.rs b/crates/core/src/entity_index/mod.rsindex f9dce118..b2dfcd6e 100644--- a/crates/core/src/entity_index/mod.rs+++ b/crates/core/src/entity_index/mod.rs@@ -20,7 +20,7 @@ use base64::{prelude::BASE64_STANDARD as BASE64_ENGINE, Engine};use serde::{Deserialize, Serialize};use tantivy::{collector::TopDocs,- query::{BooleanQuery, MoreLikeThisQuery, Occur, QueryClone, TermQuery},+ query::{BooleanQuery, BoostQuery, MoreLikeThisQuery, Occur, QueryClone, TermQuery},schema::{BytesOptions, IndexRecordOption, Schema, TextFieldIndexing, TextOptions},tokenizer::Tokenizer,DocAddress, IndexReader, IndexWriter, Searcher, TantivyDocument, Term,@@ -255,9 +255,13 @@ impl EntityIndex {term_queries.push((Occur::Must,- TermQuery::new(- Term::from_field_text(title, &token.text),- IndexRecordOption::WithFreqsAndPositions,+ BoostQuery::new(+ TermQuery::new(+ Term::from_field_text(title, &token.text),+ IndexRecordOption::WithFreqsAndPositions,+ )+ .box_clone(),+ 5.0,).box_clone(),));