web search done right
hopefully fix non-detministic test failure of 'fetch_time_ranking' and 'liked_hosts' tests
Mikkel Denker9ea1546272d8
diff --git a/configs/api.toml b/configs/api.tomlindex ddd27b1b..3bf1797f 100644--- a/configs/api.toml+++ b/configs/api.toml@@ -22,7 +22,7 @@ correction_threshold = 3.0lm_prob_weight = 1.0[llm]-api_base= "http://localhost:4000/v1"+api_base = "http://localhost:4000/v1"model = "data/mistral-7b-instruct-v0.2.Q4_K_M.gguf"# model = "TheBloke/Mistral-7B-Instruct-v0.2-AWQ"# model = "mistralai/Mixtral-8x7B-Instruct-v0.1"diff --git a/crates/core/src/query/optic.rs b/crates/core/src/query/optic.rsindex 118963cf..f0de4c25 100644--- a/crates/core/src/query/optic.rs+++ b/crates/core/src/query/optic.rs@@ -262,7 +262,10 @@ impl AsTantivyQuery for Matching {#[cfg(test)]mod tests {- use optics::{HostRankings, Optic};+ use optics::{+ ast::{RankingCoeff, RankingTarget},+ HostRankings, Optic,+ };use crate::{gen_temp_path,@@ -726,16 +729,18 @@ mod tests {let res = searcher.search(&SearchQuery {query: "website".to_string(),- optic: Some(- Optic::parse(- r#"- Like(Site("www.a.com"));- Like(Site("www.b.com"));- Dislike(Site("www.c.com"));- "#,- )- .unwrap(),- ),+ optic: Some(Optic {+ rankings: vec![RankingCoeff {+ target: RankingTarget::Signal("inbound_similarity".to_string()),+ value: 100_000.0,+ }],+ host_rankings: HostRankings {+ liked: vec!["www.a.com".to_string(), "www.b.com".to_string()],+ disliked: vec!["www.c.com".to_string()],+ ..Default::default()+ },+ ..Default::default()+ }),..Default::default()}).unwrap()diff --git a/crates/core/src/ranking/mod.rs b/crates/core/src/ranking/mod.rsindex e241cb9e..aa0310f3 100644--- a/crates/core/src/ranking/mod.rs+++ b/crates/core/src/ranking/mod.rs@@ -126,7 +126,10 @@ impl Ranker {#[cfg(test)]mod tests {- use optics::Optic;+ use optics::{+ ast::{RankingCoeff, RankingTarget},+ Optic,+ };use crate::{index::Index,@@ -638,6 +641,13 @@ mod tests {let result = searcher.search(&SearchQuery {query: "test".to_string(),+ optic: Some(Optic {+ rankings: vec![RankingCoeff {+ target: RankingTarget::Signal("fetch_time_ms".to_string()),+ value: 100_000.0,+ }],+ ..Default::default()+ }),..Default::default()}).expect("Search failed");