From 43989fe2e4977736ec3685c6516f86b172298479 Mon Sep 17 00:00:00 2001 From: ManyTheFish Date: Tue, 3 Oct 2023 12:02:16 +0200 Subject: [PATCH 1/2] Reduce porximity range from 7 to 3 --- milli/src/proximity.rs | 2 +- milli/src/search/new/ranking_rule_graph/proximity/build.rs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/milli/src/proximity.rs b/milli/src/proximity.rs index 62f490119..8261015a3 100644 --- a/milli/src/proximity.rs +++ b/milli/src/proximity.rs @@ -2,7 +2,7 @@ use std::cmp; use crate::{relative_from_absolute_position, Position}; -pub const MAX_DISTANCE: u32 = 8; +pub const MAX_DISTANCE: u32 = 4; pub fn index_proximity(lhs: u32, rhs: u32) -> u32 { if lhs <= rhs { diff --git a/milli/src/search/new/ranking_rule_graph/proximity/build.rs b/milli/src/search/new/ranking_rule_graph/proximity/build.rs index a5c0b07cb..d9d1a77ae 100644 --- a/milli/src/search/new/ranking_rule_graph/proximity/build.rs +++ b/milli/src/search/new/ranking_rule_graph/proximity/build.rs @@ -1,6 +1,7 @@ #![allow(clippy::too_many_arguments)] use super::ProximityCondition; +use crate::proximity::MAX_DISTANCE; use crate::search::new::interner::{DedupInterner, Interned}; use crate::search::new::query_term::LocatedQueryTermSubset; use crate::search::new::SearchContext; @@ -35,7 +36,7 @@ pub fn build_edges( } let mut conditions = vec![]; - for cost in right_ngram_max..(7 + right_ngram_max) { + for cost in right_ngram_max..(((MAX_DISTANCE as usize) - 1) + right_ngram_max) { conditions.push(( cost as u32, conditions_interner.insert(ProximityCondition::Uninit { @@ -47,7 +48,7 @@ pub fn build_edges( } conditions.push(( - (7 + right_ngram_max) as u32, + ((MAX_DISTANCE - 1) + (right_ngram_max as u32)), conditions_interner.insert(ProximityCondition::Term { term: right_term.clone() }), )); From 27eec21415045af8f16ab071d4c61a1688d6b721 Mon Sep 17 00:00:00 2001 From: ManyTheFish Date: Tue, 17 Oct 2023 17:19:45 +0200 Subject: [PATCH 2/2] Fix tests --- meilisearch/tests/search/mod.rs | 2 +- milli/src/search/new/tests/proximity.rs | 26 +- milli/src/search/new/tests/proximity_typo.rs | 8 +- ...xactness__proximity_after_exactness-4.snap | 12 +- ..._exactness__proximity_after_exactness.snap | 36 +-- ...ts__proximity__proximity_prefix_db-11.snap | 100 +++---- ...ts__proximity__proximity_prefix_db-14.snap | 38 +-- ...sts__proximity__proximity_prefix_db-2.snap | 40 +-- ...sts__proximity__proximity_prefix_db-5.snap | 102 +++---- ...sts__proximity__proximity_prefix_db-8.snap | 16 +- ...ts__proximity__proximity_split_word-2.snap | 16 +- ...ts__proximity__proximity_split_word-5.snap | 10 +- ...ts__proximity__proximity_split_word-8.snap | 10 +- ..._proximity__trap_basic_and_complex1-2.snap | 16 +- ...ests__typo_proximity__trap_complex2-2.snap | 8 +- ...ms__words_proximity_tms_last_phrase-2.snap | 274 +++++++++--------- ...ms__words_proximity_tms_last_phrase-5.snap | 44 +-- ...ms__words_proximity_tms_last_simple-2.snap | 78 ++--- ...ms__words_proximity_tms_last_simple-5.snap | 78 ++--- ...ew__tests__words_tms__words_tms_all-2.snap | 46 +-- milli/src/search/new/tests/stop_words.rs | 8 +- milli/src/search/new/tests/words_tms.rs | 16 +- .../word_prefix_pair_proximity_docids.snap | 3 - .../update/word_pair_proximity_docids.snap | 6 - .../word_prefix_pair_proximity_docids.snap | 4 - .../word_prefix_pair_proximity_docids.snap | 1 - .../word_prefix_pair_proximity_docids.snap | 1 - .../word_prefix_pair_proximity_docids.snap | 1 - .../word_prefix_pair_proximity_docids.snap | 1 - .../word_prefix_pair_proximity_docids.snap | 1 - .../word_prefix_pair_proximity_docids.snap | 2 - .../word_prefix_pair_proximity_docids.snap | 1 - 32 files changed, 492 insertions(+), 513 deletions(-) diff --git a/meilisearch/tests/search/mod.rs b/meilisearch/tests/search/mod.rs index 44051eb39..12b1c9d76 100644 --- a/meilisearch/tests/search/mod.rs +++ b/meilisearch/tests/search/mod.rs @@ -816,7 +816,7 @@ async fn experimental_feature_score_details() { }, "proximity": { "order": 2, - "score": 0.875 + "score": 0.75 }, "attribute": { "order": 3, diff --git a/milli/src/search/new/tests/proximity.rs b/milli/src/search/new/tests/proximity.rs index f9ad2b57e..4d340ae1c 100644 --- a/milli/src/search/new/tests/proximity.rs +++ b/milli/src/search/new/tests/proximity.rs @@ -273,7 +273,7 @@ fn test_proximity_simple() { s.terms_matching_strategy(TermsMatchingStrategy::All); s.query("the quick brown fox jumps over the lazy dog"); let SearchResult { documents_ids, .. } = s.execute().unwrap(); - insta::assert_snapshot!(format!("{documents_ids:?}"), @"[9, 10, 4, 7, 6, 5, 2, 3, 0, 1]"); + insta::assert_snapshot!(format!("{documents_ids:?}"), @"[9, 10, 4, 7, 6, 2, 3, 5, 1, 0]"); let texts = collect_field_values(&index, &txn, "text", &documents_ids); insta::assert_debug_snapshot!(texts, @r###" [ @@ -282,11 +282,11 @@ fn test_proximity_simple() { "\"the quickbrown fox jumps over the lazy dog\"", "\"the really quick brown fox jumps over the lazy dog\"", "\"the really quick brown fox jumps over the very lazy dog\"", - "\"brown quick fox jumps over the lazy dog\"", "\"the quick brown fox jumps over the lazy. dog\"", "\"dog the quick brown fox jumps over the lazy\"", - "\"the very quick dark brown and smart fox did jump over the terribly lazy and small dog\"", + "\"brown quick fox jumps over the lazy dog\"", "\"the. quick brown fox jumps over the lazy. dog\"", + "\"the very quick dark brown and smart fox did jump over the terribly lazy and small dog\"", ] "###); } @@ -371,7 +371,7 @@ fn test_proximity_prefix_db() { s.scoring_strategy(crate::score_details::ScoringStrategy::Detailed); s.query("best s"); let SearchResult { documents_ids, document_scores, .. } = s.execute().unwrap(); - insta::assert_snapshot!(format!("{documents_ids:?}"), @"[10, 13, 9, 12, 8, 6, 7, 11, 15]"); + insta::assert_snapshot!(format!("{documents_ids:?}"), @"[10, 13, 9, 12, 6, 7, 8, 11, 15]"); insta::assert_snapshot!(format!("{document_scores:#?}")); let texts = collect_field_values(&index, &txn, "text", &documents_ids); @@ -382,9 +382,9 @@ fn test_proximity_prefix_db() { "\"summer best\"", "\"this is the best meal of summer\"", "\"summer x best\"", - "\"this is the best meal of the summer\"", "\"this is the best meal I have ever had in such a beautiful summer day\"", "\"this is the best cooked meal of the summer\"", + "\"this is the best meal of the summer\"", "\"summer x y best\"", "\"this is the best meal I have ever had in such a beautiful winter day\"", ] @@ -396,7 +396,7 @@ fn test_proximity_prefix_db() { s.scoring_strategy(crate::score_details::ScoringStrategy::Detailed); s.query("best su"); let SearchResult { documents_ids, document_scores, .. } = s.execute().unwrap(); - insta::assert_snapshot!(format!("{documents_ids:?}"), @"[10, 13, 9, 12, 8, 11, 7, 6, 15]"); + insta::assert_snapshot!(format!("{documents_ids:?}"), @"[10, 13, 9, 12, 6, 7, 8, 11, 15]"); insta::assert_snapshot!(format!("{document_scores:#?}")); let texts = collect_field_values(&index, &txn, "text", &documents_ids); @@ -406,10 +406,10 @@ fn test_proximity_prefix_db() { "\"summer best\"", "\"this is the best meal of summer\"", "\"summer x best\"", + "\"this is the best meal I have ever had in such a beautiful summer day\"", + "\"this is the best cooked meal of the summer\"", "\"this is the best meal of the summer\"", "\"summer x y best\"", - "\"this is the best cooked meal of the summer\"", - "\"this is the best meal I have ever had in such a beautiful summer day\"", "\"this is the best meal I have ever had in such a beautiful winter day\"", ] "###); @@ -447,7 +447,7 @@ fn test_proximity_prefix_db() { s.scoring_strategy(crate::score_details::ScoringStrategy::Detailed); s.query("best wint"); let SearchResult { documents_ids, document_scores, .. } = s.execute().unwrap(); - insta::assert_snapshot!(format!("{documents_ids:?}"), @"[19, 22, 18, 21, 17, 20, 16, 15]"); + insta::assert_snapshot!(format!("{documents_ids:?}"), @"[19, 22, 18, 21, 15, 16, 17, 20]"); insta::assert_snapshot!(format!("{document_scores:#?}")); let texts = collect_field_values(&index, &txn, "text", &documents_ids); @@ -457,10 +457,10 @@ fn test_proximity_prefix_db() { "\"winter best\"", "\"this is the best meal of winter\"", "\"winter x best\"", + "\"this is the best meal I have ever had in such a beautiful winter day\"", + "\"this is the best cooked meal of the winter\"", "\"this is the best meal of the winter\"", "\"winter x y best\"", - "\"this is the best cooked meal of the winter\"", - "\"this is the best meal I have ever had in such a beautiful winter day\"", ] "###); @@ -471,7 +471,7 @@ fn test_proximity_prefix_db() { s.scoring_strategy(crate::score_details::ScoringStrategy::Detailed); s.query("best wi"); let SearchResult { documents_ids, document_scores, .. } = s.execute().unwrap(); - insta::assert_snapshot!(format!("{documents_ids:?}"), @"[19, 22, 18, 21, 17, 15, 16, 20]"); + insta::assert_snapshot!(format!("{documents_ids:?}"), @"[19, 22, 18, 21, 15, 16, 17, 20]"); insta::assert_snapshot!(format!("{document_scores:#?}")); let texts = collect_field_values(&index, &txn, "text", &documents_ids); @@ -481,9 +481,9 @@ fn test_proximity_prefix_db() { "\"winter best\"", "\"this is the best meal of winter\"", "\"winter x best\"", - "\"this is the best meal of the winter\"", "\"this is the best meal I have ever had in such a beautiful winter day\"", "\"this is the best cooked meal of the winter\"", + "\"this is the best meal of the winter\"", "\"winter x y best\"", ] "###); diff --git a/milli/src/search/new/tests/proximity_typo.rs b/milli/src/search/new/tests/proximity_typo.rs index 9fad21690..e58fa70fe 100644 --- a/milli/src/search/new/tests/proximity_typo.rs +++ b/milli/src/search/new/tests/proximity_typo.rs @@ -68,8 +68,8 @@ fn test_trap_basic() { [ Proximity( Rank { - rank: 8, - max_rank: 8, + rank: 4, + max_rank: 4, }, ), Typo( @@ -82,8 +82,8 @@ fn test_trap_basic() { [ Proximity( Rank { - rank: 8, - max_rank: 8, + rank: 4, + max_rank: 4, }, ), Typo( diff --git a/milli/src/search/new/tests/snapshots/milli__search__new__tests__exactness__proximity_after_exactness-4.snap b/milli/src/search/new/tests/snapshots/milli__search__new__tests__exactness__proximity_after_exactness-4.snap index 5db8f8da8..0268845bd 100644 --- a/milli/src/search/new/tests/snapshots/milli__search__new__tests__exactness__proximity_after_exactness-4.snap +++ b/milli/src/search/new/tests/snapshots/milli__search__new__tests__exactness__proximity_after_exactness-4.snap @@ -23,8 +23,8 @@ expression: "format!(\"{document_ids_scores:#?}\")" ), Proximity( Rank { - rank: 35, - max_rank: 57, + rank: 9, + max_rank: 25, }, ), ], @@ -49,8 +49,8 @@ expression: "format!(\"{document_ids_scores:#?}\")" ), Proximity( Rank { - rank: 35, - max_rank: 57, + rank: 9, + max_rank: 25, }, ), ], @@ -75,8 +75,8 @@ expression: "format!(\"{document_ids_scores:#?}\")" ), Proximity( Rank { - rank: 35, - max_rank: 57, + rank: 9, + max_rank: 25, }, ), ], diff --git a/milli/src/search/new/tests/snapshots/milli__search__new__tests__exactness__proximity_after_exactness.snap b/milli/src/search/new/tests/snapshots/milli__search__new__tests__exactness__proximity_after_exactness.snap index c99b50284..b0d60f6d4 100644 --- a/milli/src/search/new/tests/snapshots/milli__search__new__tests__exactness__proximity_after_exactness.snap +++ b/milli/src/search/new/tests/snapshots/milli__search__new__tests__exactness__proximity_after_exactness.snap @@ -23,8 +23,8 @@ expression: "format!(\"{document_ids_scores:#?}\")" ), Proximity( Rank { - rank: 57, - max_rank: 57, + rank: 25, + max_rank: 25, }, ), ], @@ -49,8 +49,8 @@ expression: "format!(\"{document_ids_scores:#?}\")" ), Proximity( Rank { - rank: 56, - max_rank: 57, + rank: 24, + max_rank: 25, }, ), ], @@ -75,8 +75,8 @@ expression: "format!(\"{document_ids_scores:#?}\")" ), Proximity( Rank { - rank: 35, - max_rank: 57, + rank: 9, + max_rank: 25, }, ), ], @@ -101,8 +101,8 @@ expression: "format!(\"{document_ids_scores:#?}\")" ), Proximity( Rank { - rank: 22, - max_rank: 22, + rank: 10, + max_rank: 10, }, ), ], @@ -127,8 +127,8 @@ expression: "format!(\"{document_ids_scores:#?}\")" ), Proximity( Rank { - rank: 22, - max_rank: 22, + rank: 10, + max_rank: 10, }, ), ], @@ -153,8 +153,8 @@ expression: "format!(\"{document_ids_scores:#?}\")" ), Proximity( Rank { - rank: 22, - max_rank: 22, + rank: 10, + max_rank: 10, }, ), ], @@ -179,8 +179,8 @@ expression: "format!(\"{document_ids_scores:#?}\")" ), Proximity( Rank { - rank: 21, - max_rank: 22, + rank: 9, + max_rank: 10, }, ), ], @@ -205,8 +205,8 @@ expression: "format!(\"{document_ids_scores:#?}\")" ), Proximity( Rank { - rank: 17, - max_rank: 22, + rank: 5, + max_rank: 10, }, ), ], @@ -231,8 +231,8 @@ expression: "format!(\"{document_ids_scores:#?}\")" ), Proximity( Rank { - rank: 17, - max_rank: 22, + rank: 5, + max_rank: 10, }, ), ], diff --git a/milli/src/search/new/tests/snapshots/milli__search__new__tests__proximity__proximity_prefix_db-11.snap b/milli/src/search/new/tests/snapshots/milli__search__new__tests__proximity__proximity_prefix_db-11.snap index 0860aaf83..8f3b964c1 100644 --- a/milli/src/search/new/tests/snapshots/milli__search__new__tests__proximity__proximity_prefix_db-11.snap +++ b/milli/src/search/new/tests/snapshots/milli__search__new__tests__proximity__proximity_prefix_db-11.snap @@ -3,59 +3,35 @@ source: milli/src/search/new/tests/proximity.rs expression: "format!(\"{document_scores:#?}\")" --- [ - [ - Proximity( - Rank { - rank: 8, - max_rank: 8, - }, - ), - ], - [ - Proximity( - Rank { - rank: 7, - max_rank: 8, - }, - ), - ], - [ - Proximity( - Rank { - rank: 6, - max_rank: 8, - }, - ), - ], - [ - Proximity( - Rank { - rank: 6, - max_rank: 8, - }, - ), - ], - [ - Proximity( - Rank { - rank: 5, - max_rank: 8, - }, - ), - ], - [ - Proximity( - Rank { - rank: 5, - max_rank: 8, - }, - ), - ], [ Proximity( Rank { rank: 4, - max_rank: 8, + max_rank: 4, + }, + ), + ], + [ + Proximity( + Rank { + rank: 3, + max_rank: 4, + }, + ), + ], + [ + Proximity( + Rank { + rank: 2, + max_rank: 4, + }, + ), + ], + [ + Proximity( + Rank { + rank: 2, + max_rank: 4, }, ), ], @@ -63,7 +39,31 @@ expression: "format!(\"{document_scores:#?}\")" Proximity( Rank { rank: 1, - max_rank: 8, + max_rank: 4, + }, + ), + ], + [ + Proximity( + Rank { + rank: 1, + max_rank: 4, + }, + ), + ], + [ + Proximity( + Rank { + rank: 1, + max_rank: 4, + }, + ), + ], + [ + Proximity( + Rank { + rank: 1, + max_rank: 4, }, ), ], diff --git a/milli/src/search/new/tests/snapshots/milli__search__new__tests__proximity__proximity_prefix_db-14.snap b/milli/src/search/new/tests/snapshots/milli__search__new__tests__proximity__proximity_prefix_db-14.snap index ca74b9c58..8f3b964c1 100644 --- a/milli/src/search/new/tests/snapshots/milli__search__new__tests__proximity__proximity_prefix_db-14.snap +++ b/milli/src/search/new/tests/snapshots/milli__search__new__tests__proximity__proximity_prefix_db-14.snap @@ -6,40 +6,32 @@ expression: "format!(\"{document_scores:#?}\")" [ Proximity( Rank { - rank: 8, - max_rank: 8, + rank: 4, + max_rank: 4, }, ), ], [ Proximity( Rank { - rank: 7, - max_rank: 8, + rank: 3, + max_rank: 4, }, ), ], [ Proximity( Rank { - rank: 6, - max_rank: 8, + rank: 2, + max_rank: 4, }, ), ], [ Proximity( Rank { - rank: 6, - max_rank: 8, - }, - ), - ], - [ - Proximity( - Rank { - rank: 5, - max_rank: 8, + rank: 2, + max_rank: 4, }, ), ], @@ -47,7 +39,7 @@ expression: "format!(\"{document_scores:#?}\")" Proximity( Rank { rank: 1, - max_rank: 8, + max_rank: 4, }, ), ], @@ -55,7 +47,7 @@ expression: "format!(\"{document_scores:#?}\")" Proximity( Rank { rank: 1, - max_rank: 8, + max_rank: 4, }, ), ], @@ -63,7 +55,15 @@ expression: "format!(\"{document_scores:#?}\")" Proximity( Rank { rank: 1, - max_rank: 8, + max_rank: 4, + }, + ), + ], + [ + Proximity( + Rank { + rank: 1, + max_rank: 4, }, ), ], diff --git a/milli/src/search/new/tests/snapshots/milli__search__new__tests__proximity__proximity_prefix_db-2.snap b/milli/src/search/new/tests/snapshots/milli__search__new__tests__proximity__proximity_prefix_db-2.snap index a6a01fbba..1ee6bfc91 100644 --- a/milli/src/search/new/tests/snapshots/milli__search__new__tests__proximity__proximity_prefix_db-2.snap +++ b/milli/src/search/new/tests/snapshots/milli__search__new__tests__proximity__proximity_prefix_db-2.snap @@ -6,40 +6,32 @@ expression: "format!(\"{document_scores:#?}\")" [ Proximity( Rank { - rank: 8, - max_rank: 8, + rank: 4, + max_rank: 4, }, ), ], [ Proximity( Rank { - rank: 7, - max_rank: 8, + rank: 3, + max_rank: 4, }, ), ], [ Proximity( Rank { - rank: 6, - max_rank: 8, + rank: 2, + max_rank: 4, }, ), ], [ Proximity( Rank { - rank: 6, - max_rank: 8, - }, - ), - ], - [ - Proximity( - Rank { - rank: 5, - max_rank: 8, + rank: 2, + max_rank: 4, }, ), ], @@ -47,7 +39,7 @@ expression: "format!(\"{document_scores:#?}\")" Proximity( Rank { rank: 1, - max_rank: 8, + max_rank: 4, }, ), ], @@ -55,7 +47,7 @@ expression: "format!(\"{document_scores:#?}\")" Proximity( Rank { rank: 1, - max_rank: 8, + max_rank: 4, }, ), ], @@ -63,7 +55,7 @@ expression: "format!(\"{document_scores:#?}\")" Proximity( Rank { rank: 1, - max_rank: 8, + max_rank: 4, }, ), ], @@ -71,7 +63,15 @@ expression: "format!(\"{document_scores:#?}\")" Proximity( Rank { rank: 1, - max_rank: 8, + max_rank: 4, + }, + ), + ], + [ + Proximity( + Rank { + rank: 1, + max_rank: 4, }, ), ], diff --git a/milli/src/search/new/tests/snapshots/milli__search__new__tests__proximity__proximity_prefix_db-5.snap b/milli/src/search/new/tests/snapshots/milli__search__new__tests__proximity__proximity_prefix_db-5.snap index 13e49d4bc..1ee6bfc91 100644 --- a/milli/src/search/new/tests/snapshots/milli__search__new__tests__proximity__proximity_prefix_db-5.snap +++ b/milli/src/search/new/tests/snapshots/milli__search__new__tests__proximity__proximity_prefix_db-5.snap @@ -3,59 +3,35 @@ source: milli/src/search/new/tests/proximity.rs expression: "format!(\"{document_scores:#?}\")" --- [ - [ - Proximity( - Rank { - rank: 8, - max_rank: 8, - }, - ), - ], - [ - Proximity( - Rank { - rank: 7, - max_rank: 8, - }, - ), - ], - [ - Proximity( - Rank { - rank: 6, - max_rank: 8, - }, - ), - ], - [ - Proximity( - Rank { - rank: 6, - max_rank: 8, - }, - ), - ], - [ - Proximity( - Rank { - rank: 5, - max_rank: 8, - }, - ), - ], - [ - Proximity( - Rank { - rank: 5, - max_rank: 8, - }, - ), - ], [ Proximity( Rank { rank: 4, - max_rank: 8, + max_rank: 4, + }, + ), + ], + [ + Proximity( + Rank { + rank: 3, + max_rank: 4, + }, + ), + ], + [ + Proximity( + Rank { + rank: 2, + max_rank: 4, + }, + ), + ], + [ + Proximity( + Rank { + rank: 2, + max_rank: 4, }, ), ], @@ -63,7 +39,7 @@ expression: "format!(\"{document_scores:#?}\")" Proximity( Rank { rank: 1, - max_rank: 8, + max_rank: 4, }, ), ], @@ -71,7 +47,31 @@ expression: "format!(\"{document_scores:#?}\")" Proximity( Rank { rank: 1, - max_rank: 8, + max_rank: 4, + }, + ), + ], + [ + Proximity( + Rank { + rank: 1, + max_rank: 4, + }, + ), + ], + [ + Proximity( + Rank { + rank: 1, + max_rank: 4, + }, + ), + ], + [ + Proximity( + Rank { + rank: 1, + max_rank: 4, }, ), ], diff --git a/milli/src/search/new/tests/snapshots/milli__search__new__tests__proximity__proximity_prefix_db-8.snap b/milli/src/search/new/tests/snapshots/milli__search__new__tests__proximity__proximity_prefix_db-8.snap index a7d18b8fc..5129f1b3b 100644 --- a/milli/src/search/new/tests/snapshots/milli__search__new__tests__proximity__proximity_prefix_db-8.snap +++ b/milli/src/search/new/tests/snapshots/milli__search__new__tests__proximity__proximity_prefix_db-8.snap @@ -7,7 +7,7 @@ expression: "format!(\"{document_scores:#?}\")" Proximity( Rank { rank: 1, - max_rank: 8, + max_rank: 4, }, ), ], @@ -15,7 +15,7 @@ expression: "format!(\"{document_scores:#?}\")" Proximity( Rank { rank: 1, - max_rank: 8, + max_rank: 4, }, ), ], @@ -23,7 +23,7 @@ expression: "format!(\"{document_scores:#?}\")" Proximity( Rank { rank: 1, - max_rank: 8, + max_rank: 4, }, ), ], @@ -31,7 +31,7 @@ expression: "format!(\"{document_scores:#?}\")" Proximity( Rank { rank: 1, - max_rank: 8, + max_rank: 4, }, ), ], @@ -39,7 +39,7 @@ expression: "format!(\"{document_scores:#?}\")" Proximity( Rank { rank: 1, - max_rank: 8, + max_rank: 4, }, ), ], @@ -47,7 +47,7 @@ expression: "format!(\"{document_scores:#?}\")" Proximity( Rank { rank: 1, - max_rank: 8, + max_rank: 4, }, ), ], @@ -55,7 +55,7 @@ expression: "format!(\"{document_scores:#?}\")" Proximity( Rank { rank: 1, - max_rank: 8, + max_rank: 4, }, ), ], @@ -63,7 +63,7 @@ expression: "format!(\"{document_scores:#?}\")" Proximity( Rank { rank: 1, - max_rank: 8, + max_rank: 4, }, ), ], diff --git a/milli/src/search/new/tests/snapshots/milli__search__new__tests__proximity__proximity_split_word-2.snap b/milli/src/search/new/tests/snapshots/milli__search__new__tests__proximity__proximity_split_word-2.snap index 6a43c385e..a7936a454 100644 --- a/milli/src/search/new/tests/snapshots/milli__search__new__tests__proximity__proximity_split_word-2.snap +++ b/milli/src/search/new/tests/snapshots/milli__search__new__tests__proximity__proximity_split_word-2.snap @@ -6,24 +6,24 @@ expression: "format!(\"{document_scores:#?}\")" [ Proximity( Rank { - rank: 8, - max_rank: 8, + rank: 4, + max_rank: 4, }, ), ], [ Proximity( Rank { - rank: 8, - max_rank: 8, + rank: 4, + max_rank: 4, }, ), ], [ Proximity( Rank { - rank: 8, - max_rank: 8, + rank: 4, + max_rank: 4, }, ), ], @@ -31,7 +31,7 @@ expression: "format!(\"{document_scores:#?}\")" Proximity( Rank { rank: 1, - max_rank: 8, + max_rank: 4, }, ), ], @@ -39,7 +39,7 @@ expression: "format!(\"{document_scores:#?}\")" Proximity( Rank { rank: 1, - max_rank: 8, + max_rank: 4, }, ), ], diff --git a/milli/src/search/new/tests/snapshots/milli__search__new__tests__proximity__proximity_split_word-5.snap b/milli/src/search/new/tests/snapshots/milli__search__new__tests__proximity__proximity_split_word-5.snap index 5d8caae94..236e3fe1e 100644 --- a/milli/src/search/new/tests/snapshots/milli__search__new__tests__proximity__proximity_split_word-5.snap +++ b/milli/src/search/new/tests/snapshots/milli__search__new__tests__proximity__proximity_split_word-5.snap @@ -6,16 +6,16 @@ expression: "format!(\"{document_scores:#?}\")" [ Proximity( Rank { - rank: 8, - max_rank: 8, + rank: 4, + max_rank: 4, }, ), ], [ Proximity( Rank { - rank: 8, - max_rank: 8, + rank: 4, + max_rank: 4, }, ), ], @@ -23,7 +23,7 @@ expression: "format!(\"{document_scores:#?}\")" Proximity( Rank { rank: 1, - max_rank: 8, + max_rank: 4, }, ), ], diff --git a/milli/src/search/new/tests/snapshots/milli__search__new__tests__proximity__proximity_split_word-8.snap b/milli/src/search/new/tests/snapshots/milli__search__new__tests__proximity__proximity_split_word-8.snap index 5d8caae94..236e3fe1e 100644 --- a/milli/src/search/new/tests/snapshots/milli__search__new__tests__proximity__proximity_split_word-8.snap +++ b/milli/src/search/new/tests/snapshots/milli__search__new__tests__proximity__proximity_split_word-8.snap @@ -6,16 +6,16 @@ expression: "format!(\"{document_scores:#?}\")" [ Proximity( Rank { - rank: 8, - max_rank: 8, + rank: 4, + max_rank: 4, }, ), ], [ Proximity( Rank { - rank: 8, - max_rank: 8, + rank: 4, + max_rank: 4, }, ), ], @@ -23,7 +23,7 @@ expression: "format!(\"{document_scores:#?}\")" Proximity( Rank { rank: 1, - max_rank: 8, + max_rank: 4, }, ), ], diff --git a/milli/src/search/new/tests/snapshots/milli__search__new__tests__typo_proximity__trap_basic_and_complex1-2.snap b/milli/src/search/new/tests/snapshots/milli__search__new__tests__typo_proximity__trap_basic_and_complex1-2.snap index 09cb68044..1f7c76ea8 100644 --- a/milli/src/search/new/tests/snapshots/milli__search__new__tests__typo_proximity__trap_basic_and_complex1-2.snap +++ b/milli/src/search/new/tests/snapshots/milli__search__new__tests__typo_proximity__trap_basic_and_complex1-2.snap @@ -12,8 +12,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 8, - max_rank: 8, + rank: 4, + max_rank: 4, }, ), ], @@ -26,8 +26,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 5, - max_rank: 8, + rank: 1, + max_rank: 4, }, ), ], @@ -40,8 +40,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 8, - max_rank: 8, + rank: 4, + max_rank: 4, }, ), ], @@ -54,8 +54,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 7, - max_rank: 8, + rank: 3, + max_rank: 4, }, ), ], diff --git a/milli/src/search/new/tests/snapshots/milli__search__new__tests__typo_proximity__trap_complex2-2.snap b/milli/src/search/new/tests/snapshots/milli__search__new__tests__typo_proximity__trap_complex2-2.snap index 5b93dfecd..6055961d9 100644 --- a/milli/src/search/new/tests/snapshots/milli__search__new__tests__typo_proximity__trap_complex2-2.snap +++ b/milli/src/search/new/tests/snapshots/milli__search__new__tests__typo_proximity__trap_complex2-2.snap @@ -12,8 +12,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 15, - max_rank: 15, + rank: 7, + max_rank: 7, }, ), ], @@ -26,8 +26,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 8, - max_rank: 15, + rank: 4, + max_rank: 7, }, ), ], diff --git a/milli/src/search/new/tests/snapshots/milli__search__new__tests__words_tms__words_proximity_tms_last_phrase-2.snap b/milli/src/search/new/tests/snapshots/milli__search__new__tests__words_tms__words_proximity_tms_last_phrase-2.snap index 61c39153f..a4a0b77a3 100644 --- a/milli/src/search/new/tests/snapshots/milli__search__new__tests__words_tms__words_proximity_tms_last_phrase-2.snap +++ b/milli/src/search/new/tests/snapshots/milli__search__new__tests__words_tms__words_proximity_tms_last_phrase-2.snap @@ -12,8 +12,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 50, - max_rank: 50, + rank: 22, + max_rank: 22, }, ), ], @@ -24,132 +24,6 @@ expression: "format!(\"{document_scores:#?}\")" max_matching_words: 9, }, ), - Proximity( - Rank { - rank: 50, - max_rank: 50, - }, - ), - ], - [ - Words( - Words { - matching_words: 9, - max_matching_words: 9, - }, - ), - Proximity( - Rank { - rank: 49, - max_rank: 50, - }, - ), - ], - [ - Words( - Words { - matching_words: 9, - max_matching_words: 9, - }, - ), - Proximity( - Rank { - rank: 49, - max_rank: 50, - }, - ), - ], - [ - Words( - Words { - matching_words: 9, - max_matching_words: 9, - }, - ), - Proximity( - Rank { - rank: 48, - max_rank: 50, - }, - ), - ], - [ - Words( - Words { - matching_words: 9, - max_matching_words: 9, - }, - ), - Proximity( - Rank { - rank: 41, - max_rank: 50, - }, - ), - ], - [ - Words( - Words { - matching_words: 9, - max_matching_words: 9, - }, - ), - Proximity( - Rank { - rank: 40, - max_rank: 50, - }, - ), - ], - [ - Words( - Words { - matching_words: 8, - max_matching_words: 9, - }, - ), - Proximity( - Rank { - rank: 43, - max_rank: 43, - }, - ), - ], - [ - Words( - Words { - matching_words: 7, - max_matching_words: 9, - }, - ), - Proximity( - Rank { - rank: 36, - max_rank: 36, - }, - ), - ], - [ - Words( - Words { - matching_words: 7, - max_matching_words: 9, - }, - ), - Proximity( - Rank { - rank: 31, - max_rank: 36, - }, - ), - ], - [ - Words( - Words { - matching_words: 5, - max_matching_words: 9, - }, - ), Proximity( Rank { rank: 22, @@ -160,14 +34,126 @@ expression: "format!(\"{document_scores:#?}\")" [ Words( Words { - matching_words: 4, + matching_words: 9, max_matching_words: 9, }, ), Proximity( Rank { - rank: 15, - max_rank: 15, + rank: 21, + max_rank: 22, + }, + ), + ], + [ + Words( + Words { + matching_words: 9, + max_matching_words: 9, + }, + ), + Proximity( + Rank { + rank: 21, + max_rank: 22, + }, + ), + ], + [ + Words( + Words { + matching_words: 9, + max_matching_words: 9, + }, + ), + Proximity( + Rank { + rank: 20, + max_rank: 22, + }, + ), + ], + [ + Words( + Words { + matching_words: 9, + max_matching_words: 9, + }, + ), + Proximity( + Rank { + rank: 17, + max_rank: 22, + }, + ), + ], + [ + Words( + Words { + matching_words: 9, + max_matching_words: 9, + }, + ), + Proximity( + Rank { + rank: 16, + max_rank: 22, + }, + ), + ], + [ + Words( + Words { + matching_words: 8, + max_matching_words: 9, + }, + ), + Proximity( + Rank { + rank: 19, + max_rank: 19, + }, + ), + ], + [ + Words( + Words { + matching_words: 7, + max_matching_words: 9, + }, + ), + Proximity( + Rank { + rank: 16, + max_rank: 16, + }, + ), + ], + [ + Words( + Words { + matching_words: 7, + max_matching_words: 9, + }, + ), + Proximity( + Rank { + rank: 13, + max_rank: 16, + }, + ), + ], + [ + Words( + Words { + matching_words: 5, + max_matching_words: 9, + }, + ), + Proximity( + Rank { + rank: 10, + max_rank: 10, }, ), ], @@ -180,8 +166,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 15, - max_rank: 15, + rank: 7, + max_rank: 7, }, ), ], @@ -194,8 +180,22 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 15, - max_rank: 15, + rank: 7, + max_rank: 7, + }, + ), + ], + [ + Words( + Words { + matching_words: 4, + max_matching_words: 9, + }, + ), + Proximity( + Rank { + rank: 7, + max_rank: 7, }, ), ], @@ -208,8 +208,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 8, - max_rank: 8, + rank: 4, + max_rank: 4, }, ), ], diff --git a/milli/src/search/new/tests/snapshots/milli__search__new__tests__words_tms__words_proximity_tms_last_phrase-5.snap b/milli/src/search/new/tests/snapshots/milli__search__new__tests__words_tms__words_proximity_tms_last_phrase-5.snap index e43908ee7..6a69f0c03 100644 --- a/milli/src/search/new/tests/snapshots/milli__search__new__tests__words_tms__words_proximity_tms_last_phrase-5.snap +++ b/milli/src/search/new/tests/snapshots/milli__search__new__tests__words_tms__words_proximity_tms_last_phrase-5.snap @@ -12,8 +12,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 43, - max_rank: 43, + rank: 19, + max_rank: 19, }, ), ], @@ -26,8 +26,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 43, - max_rank: 43, + rank: 19, + max_rank: 19, }, ), ], @@ -40,8 +40,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 42, - max_rank: 43, + rank: 18, + max_rank: 19, }, ), ], @@ -54,8 +54,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 42, - max_rank: 43, + rank: 18, + max_rank: 19, }, ), ], @@ -68,8 +68,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 41, - max_rank: 43, + rank: 17, + max_rank: 19, }, ), ], @@ -82,8 +82,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 34, - max_rank: 43, + rank: 14, + max_rank: 19, }, ), ], @@ -96,8 +96,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 33, - max_rank: 43, + rank: 13, + max_rank: 19, }, ), ], @@ -110,8 +110,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 36, - max_rank: 36, + rank: 16, + max_rank: 16, }, ), ], @@ -124,8 +124,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 29, - max_rank: 29, + rank: 13, + max_rank: 13, }, ), ], @@ -138,8 +138,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 24, - max_rank: 29, + rank: 10, + max_rank: 13, }, ), ], @@ -152,8 +152,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 15, - max_rank: 15, + rank: 7, + max_rank: 7, }, ), ], diff --git a/milli/src/search/new/tests/snapshots/milli__search__new__tests__words_tms__words_proximity_tms_last_simple-2.snap b/milli/src/search/new/tests/snapshots/milli__search__new__tests__words_tms__words_proximity_tms_last_simple-2.snap index 4fc992b3d..65d074996 100644 --- a/milli/src/search/new/tests/snapshots/milli__search__new__tests__words_tms__words_proximity_tms_last_simple-2.snap +++ b/milli/src/search/new/tests/snapshots/milli__search__new__tests__words_tms__words_proximity_tms_last_simple-2.snap @@ -12,8 +12,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 57, - max_rank: 57, + rank: 25, + max_rank: 25, }, ), ], @@ -26,8 +26,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 57, - max_rank: 57, + rank: 25, + max_rank: 25, }, ), ], @@ -40,8 +40,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 56, - max_rank: 57, + rank: 24, + max_rank: 25, }, ), ], @@ -54,8 +54,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 56, - max_rank: 57, + rank: 24, + max_rank: 25, }, ), ], @@ -68,8 +68,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 55, - max_rank: 57, + rank: 23, + max_rank: 25, }, ), ], @@ -82,8 +82,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 54, - max_rank: 57, + rank: 22, + max_rank: 25, }, ), ], @@ -96,8 +96,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 53, - max_rank: 57, + rank: 21, + max_rank: 25, }, ), ], @@ -110,8 +110,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 52, - max_rank: 57, + rank: 20, + max_rank: 25, }, ), ], @@ -124,8 +124,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 51, - max_rank: 57, + rank: 20, + max_rank: 25, }, ), ], @@ -138,8 +138,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 48, - max_rank: 57, + rank: 19, + max_rank: 25, }, ), ], @@ -152,8 +152,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 47, - max_rank: 57, + rank: 19, + max_rank: 25, }, ), ], @@ -167,7 +167,7 @@ expression: "format!(\"{document_scores:#?}\")" Proximity( Rank { rank: 1, - max_rank: 57, + max_rank: 25, }, ), ], @@ -180,8 +180,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 50, - max_rank: 50, + rank: 22, + max_rank: 22, }, ), ], @@ -194,8 +194,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 43, - max_rank: 43, + rank: 19, + max_rank: 19, }, ), ], @@ -208,8 +208,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 38, - max_rank: 43, + rank: 16, + max_rank: 19, }, ), ], @@ -222,8 +222,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 29, - max_rank: 29, + rank: 13, + max_rank: 13, }, ), ], @@ -236,8 +236,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 22, - max_rank: 22, + rank: 10, + max_rank: 10, }, ), ], @@ -250,8 +250,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 22, - max_rank: 22, + rank: 10, + max_rank: 10, }, ), ], @@ -264,8 +264,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 22, - max_rank: 22, + rank: 10, + max_rank: 10, }, ), ], @@ -278,8 +278,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 15, - max_rank: 15, + rank: 7, + max_rank: 7, }, ), ], diff --git a/milli/src/search/new/tests/snapshots/milli__search__new__tests__words_tms__words_proximity_tms_last_simple-5.snap b/milli/src/search/new/tests/snapshots/milli__search__new__tests__words_tms__words_proximity_tms_last_simple-5.snap index 1f070e381..baef33e0f 100644 --- a/milli/src/search/new/tests/snapshots/milli__search__new__tests__words_tms__words_proximity_tms_last_simple-5.snap +++ b/milli/src/search/new/tests/snapshots/milli__search__new__tests__words_tms__words_proximity_tms_last_simple-5.snap @@ -12,8 +12,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 57, - max_rank: 57, + rank: 25, + max_rank: 25, }, ), ], @@ -26,8 +26,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 56, - max_rank: 57, + rank: 24, + max_rank: 25, }, ), ], @@ -40,8 +40,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 55, - max_rank: 57, + rank: 23, + max_rank: 25, }, ), ], @@ -54,8 +54,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 54, - max_rank: 57, + rank: 22, + max_rank: 25, }, ), ], @@ -68,8 +68,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 54, - max_rank: 57, + rank: 22, + max_rank: 25, }, ), ], @@ -82,8 +82,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 54, - max_rank: 57, + rank: 22, + max_rank: 25, }, ), ], @@ -96,8 +96,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 53, - max_rank: 57, + rank: 21, + max_rank: 25, }, ), ], @@ -110,8 +110,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 53, - max_rank: 57, + rank: 21, + max_rank: 25, }, ), ], @@ -124,8 +124,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 52, - max_rank: 57, + rank: 20, + max_rank: 25, }, ), ], @@ -138,8 +138,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 47, - max_rank: 57, + rank: 18, + max_rank: 25, }, ), ], @@ -152,8 +152,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 45, - max_rank: 57, + rank: 18, + max_rank: 25, }, ), ], @@ -167,7 +167,7 @@ expression: "format!(\"{document_scores:#?}\")" Proximity( Rank { rank: 1, - max_rank: 57, + max_rank: 25, }, ), ], @@ -180,8 +180,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 47, - max_rank: 50, + rank: 19, + max_rank: 22, }, ), ], @@ -194,8 +194,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 40, - max_rank: 43, + rank: 16, + max_rank: 19, }, ), ], @@ -208,8 +208,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 35, - max_rank: 43, + rank: 13, + max_rank: 19, }, ), ], @@ -222,8 +222,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 26, - max_rank: 29, + rank: 10, + max_rank: 13, }, ), ], @@ -236,8 +236,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 19, - max_rank: 22, + rank: 7, + max_rank: 10, }, ), ], @@ -250,8 +250,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 19, - max_rank: 22, + rank: 7, + max_rank: 10, }, ), ], @@ -264,8 +264,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 19, - max_rank: 22, + rank: 7, + max_rank: 10, }, ), ], @@ -278,8 +278,8 @@ expression: "format!(\"{document_scores:#?}\")" ), Proximity( Rank { - rank: 13, - max_rank: 15, + rank: 5, + max_rank: 7, }, ), ], diff --git a/milli/src/search/new/tests/snapshots/milli__search__new__tests__words_tms__words_tms_all-2.snap b/milli/src/search/new/tests/snapshots/milli__search__new__tests__words_tms__words_tms_all-2.snap index ff74473c8..18648a324 100644 --- a/milli/src/search/new/tests/snapshots/milli__search__new__tests__words_tms__words_tms_all-2.snap +++ b/milli/src/search/new/tests/snapshots/milli__search__new__tests__words_tms__words_tms_all-2.snap @@ -6,88 +6,88 @@ expression: "format!(\"{document_scores:#?}\")" [ Proximity( Rank { - rank: 57, - max_rank: 57, + rank: 25, + max_rank: 25, }, ), ], [ Proximity( Rank { - rank: 57, - max_rank: 57, + rank: 25, + max_rank: 25, }, ), ], [ Proximity( Rank { - rank: 56, - max_rank: 57, + rank: 24, + max_rank: 25, }, ), ], [ Proximity( Rank { - rank: 56, - max_rank: 57, + rank: 24, + max_rank: 25, }, ), ], [ Proximity( Rank { - rank: 55, - max_rank: 57, + rank: 23, + max_rank: 25, }, ), ], [ Proximity( Rank { - rank: 54, - max_rank: 57, + rank: 22, + max_rank: 25, }, ), ], [ Proximity( Rank { - rank: 53, - max_rank: 57, + rank: 21, + max_rank: 25, }, ), ], [ Proximity( Rank { - rank: 52, - max_rank: 57, + rank: 20, + max_rank: 25, }, ), ], [ Proximity( Rank { - rank: 51, - max_rank: 57, + rank: 20, + max_rank: 25, }, ), ], [ Proximity( Rank { - rank: 48, - max_rank: 57, + rank: 19, + max_rank: 25, }, ), ], [ Proximity( Rank { - rank: 47, - max_rank: 57, + rank: 19, + max_rank: 25, }, ), ], @@ -95,7 +95,7 @@ expression: "format!(\"{document_scores:#?}\")" Proximity( Rank { rank: 1, - max_rank: 57, + max_rank: 25, }, ), ], diff --git a/milli/src/search/new/tests/stop_words.rs b/milli/src/search/new/tests/stop_words.rs index 2b06264f5..629751b48 100644 --- a/milli/src/search/new/tests/stop_words.rs +++ b/milli/src/search/new/tests/stop_words.rs @@ -259,8 +259,8 @@ fn test_ignore_stop_words() { ), Proximity( Rank { - rank: 7, - max_rank: 8, + rank: 3, + max_rank: 4, }, ), Fid( @@ -411,8 +411,8 @@ fn test_stop_words_in_phrase() { ), Proximity( Rank { - rank: 6, - max_rank: 8, + rank: 2, + max_rank: 4, }, ), Fid( diff --git a/milli/src/search/new/tests/words_tms.rs b/milli/src/search/new/tests/words_tms.rs index 27213ecff..ee8cfc51b 100644 --- a/milli/src/search/new/tests/words_tms.rs +++ b/milli/src/search/new/tests/words_tms.rs @@ -277,7 +277,7 @@ fn test_words_proximity_tms_last_simple() { let SearchResult { documents_ids, document_scores, .. } = s.execute().unwrap(); // 7 is better than 6 because of the proximity between "the" and its surrounding terms - insta::assert_snapshot!(format!("{documents_ids:?}"), @"[9, 21, 14, 17, 13, 10, 18, 19, 20, 16, 15, 22, 8, 7, 6, 5, 4, 11, 12, 3]"); + insta::assert_snapshot!(format!("{documents_ids:?}"), @"[9, 21, 14, 17, 13, 10, 18, 16, 19, 15, 20, 22, 8, 7, 6, 5, 4, 11, 12, 3]"); insta::assert_snapshot!(format!("{document_scores:#?}")); let texts = collect_field_values(&index, &txn, "text", &documents_ids); insta::assert_debug_snapshot!(texts, @r###" @@ -289,10 +289,10 @@ fn test_words_proximity_tms_last_simple() { "\"the mighty and quick brown fox jumps over the lazy dog\"", "\"the brown quick fox jumps over the lazy dog\"", "\"the brown quick fox jumps over the really lazy dog\"", - "\"the brown quick fox immediately jumps over the really lazy dog\"", - "\"the brown quick fox immediately jumps over the really lazy blue dog\"", "\"this quick brown and scary fox jumps over the lazy dog\"", + "\"the brown quick fox immediately jumps over the really lazy dog\"", "\"this quick brown and very scary fox jumps over the lazy dog\"", + "\"the brown quick fox immediately jumps over the really lazy blue dog\"", "\"the, quick, brown, fox, jumps, over, the, lazy, dog\"", "\"the quick brown fox jumps over the lazy\"", "\"the quick brown fox jumps over the\"", @@ -312,7 +312,7 @@ fn test_words_proximity_tms_last_simple() { let SearchResult { documents_ids, document_scores, .. } = s.execute().unwrap(); // 10 is better than 9 because of the proximity between "quick" and "brown" - insta::assert_snapshot!(format!("{documents_ids:?}"), @"[10, 18, 19, 9, 20, 21, 14, 17, 13, 16, 15, 22, 8, 7, 6, 5, 4, 11, 12, 3]"); + insta::assert_snapshot!(format!("{documents_ids:?}"), @"[10, 18, 19, 9, 20, 21, 14, 17, 13, 15, 16, 22, 8, 7, 6, 5, 4, 11, 12, 3]"); insta::assert_snapshot!(format!("{document_scores:#?}")); let texts = collect_field_values(&index, &txn, "text", &documents_ids); insta::assert_debug_snapshot!(texts, @r###" @@ -326,8 +326,8 @@ fn test_words_proximity_tms_last_simple() { "\"the great quick brown fox jumps over the lazy dog\"", "\"the quick brown fox jumps over the really lazy dog\"", "\"the mighty and quick brown fox jumps over the lazy dog\"", - "\"this quick brown and scary fox jumps over the lazy dog\"", "\"this quick brown and very scary fox jumps over the lazy dog\"", + "\"this quick brown and scary fox jumps over the lazy dog\"", "\"the, quick, brown, fox, jumps, over, the, lazy, dog\"", "\"the quick brown fox jumps over the lazy\"", "\"the quick brown fox jumps over the\"", @@ -427,7 +427,7 @@ fn test_words_tms_all() { s.scoring_strategy(crate::score_details::ScoringStrategy::Detailed); let SearchResult { documents_ids, document_scores, .. } = s.execute().unwrap(); - insta::assert_snapshot!(format!("{documents_ids:?}"), @"[9, 21, 14, 17, 13, 10, 18, 19, 20, 16, 15, 22]"); + insta::assert_snapshot!(format!("{documents_ids:?}"), @"[9, 21, 14, 17, 13, 10, 18, 16, 19, 15, 20, 22]"); insta::assert_snapshot!(format!("{document_scores:#?}")); let texts = collect_field_values(&index, &txn, "text", &documents_ids); insta::assert_debug_snapshot!(texts, @r###" @@ -439,10 +439,10 @@ fn test_words_tms_all() { "\"the mighty and quick brown fox jumps over the lazy dog\"", "\"the brown quick fox jumps over the lazy dog\"", "\"the brown quick fox jumps over the really lazy dog\"", - "\"the brown quick fox immediately jumps over the really lazy dog\"", - "\"the brown quick fox immediately jumps over the really lazy blue dog\"", "\"this quick brown and scary fox jumps over the lazy dog\"", + "\"the brown quick fox immediately jumps over the really lazy dog\"", "\"this quick brown and very scary fox jumps over the lazy dog\"", + "\"the brown quick fox immediately jumps over the really lazy blue dog\"", "\"the, quick, brown, fox, jumps, over, the, lazy, dog\"", ] "###); diff --git a/milli/src/update/prefix_word_pairs/snapshots/mod.rs/add_new_documents/initial/word_prefix_pair_proximity_docids.snap b/milli/src/update/prefix_word_pairs/snapshots/mod.rs/add_new_documents/initial/word_prefix_pair_proximity_docids.snap index c760ae440..52b29e136 100644 --- a/milli/src/update/prefix_word_pairs/snapshots/mod.rs/add_new_documents/initial/word_prefix_pair_proximity_docids.snap +++ b/milli/src/update/prefix_word_pairs/snapshots/mod.rs/add_new_documents/initial/word_prefix_pair_proximity_docids.snap @@ -20,7 +20,4 @@ source: milli/src/update/prefix_word_pairs/mod.rs 3 at a [100, ] 3 rings a [101, ] 3 the a [101, ] -4 at b [100, ] -4 at be [100, ] -4 bell a [101, ] diff --git a/milli/src/update/prefix_word_pairs/snapshots/mod.rs/add_new_documents/update/word_pair_proximity_docids.snap b/milli/src/update/prefix_word_pairs/snapshots/mod.rs/add_new_documents/update/word_pair_proximity_docids.snap index 4fcd0fbd2..1b56974c2 100644 --- a/milli/src/update/prefix_word_pairs/snapshots/mod.rs/add_new_documents/update/word_pair_proximity_docids.snap +++ b/milli/src/update/prefix_word_pairs/snapshots/mod.rs/add_new_documents/update/word_pair_proximity_docids.snap @@ -30,10 +30,4 @@ source: milli/src/update/prefix_word_pairs/mod.rs 3 bell 5 [101, ] 3 rings am [101, ] 3 the at [101, ] -4 an house [100, ] -4 at beautiful [100, ] -4 bell am [101, ] -4 the 5 [101, ] -5 at house [100, ] -5 the am [101, ] diff --git a/milli/src/update/prefix_word_pairs/snapshots/mod.rs/add_new_documents/update/word_prefix_pair_proximity_docids.snap b/milli/src/update/prefix_word_pairs/snapshots/mod.rs/add_new_documents/update/word_prefix_pair_proximity_docids.snap index 0f2e458a8..008a4b21d 100644 --- a/milli/src/update/prefix_word_pairs/snapshots/mod.rs/add_new_documents/update/word_prefix_pair_proximity_docids.snap +++ b/milli/src/update/prefix_word_pairs/snapshots/mod.rs/add_new_documents/update/word_prefix_pair_proximity_docids.snap @@ -28,8 +28,4 @@ source: milli/src/update/prefix_word_pairs/mod.rs 3 rings a [101, ] 3 rings am [101, ] 3 the a [101, ] -4 at b [100, ] -4 at be [100, ] -4 bell a [101, ] -4 bell am [101, ] diff --git a/milli/src/update/prefix_word_pairs/snapshots/mod.rs/hard_delete_and_reupdate/first_delete/word_prefix_pair_proximity_docids.snap b/milli/src/update/prefix_word_pairs/snapshots/mod.rs/hard_delete_and_reupdate/first_delete/word_prefix_pair_proximity_docids.snap index 41c71ea59..618a0b076 100644 --- a/milli/src/update/prefix_word_pairs/snapshots/mod.rs/hard_delete_and_reupdate/first_delete/word_prefix_pair_proximity_docids.snap +++ b/milli/src/update/prefix_word_pairs/snapshots/mod.rs/hard_delete_and_reupdate/first_delete/word_prefix_pair_proximity_docids.snap @@ -7,5 +7,4 @@ source: milli/src/update/prefix_word_pairs/mod.rs 2 bell a [51, ] 3 rings a [51, ] 3 the a [51, ] -4 bell a [51, ] diff --git a/milli/src/update/prefix_word_pairs/snapshots/mod.rs/hard_delete_and_reupdate/initial/word_prefix_pair_proximity_docids.snap b/milli/src/update/prefix_word_pairs/snapshots/mod.rs/hard_delete_and_reupdate/initial/word_prefix_pair_proximity_docids.snap index e55ebed9d..885985bdf 100644 --- a/milli/src/update/prefix_word_pairs/snapshots/mod.rs/hard_delete_and_reupdate/initial/word_prefix_pair_proximity_docids.snap +++ b/milli/src/update/prefix_word_pairs/snapshots/mod.rs/hard_delete_and_reupdate/initial/word_prefix_pair_proximity_docids.snap @@ -12,5 +12,4 @@ source: milli/src/update/prefix_word_pairs/mod.rs 3 at a [50, ] 3 rings a [51, ] 3 the a [51, ] -4 bell a [51, ] diff --git a/milli/src/update/prefix_word_pairs/snapshots/mod.rs/hard_delete_and_reupdate/second_delete/word_prefix_pair_proximity_docids.snap b/milli/src/update/prefix_word_pairs/snapshots/mod.rs/hard_delete_and_reupdate/second_delete/word_prefix_pair_proximity_docids.snap index 41c71ea59..618a0b076 100644 --- a/milli/src/update/prefix_word_pairs/snapshots/mod.rs/hard_delete_and_reupdate/second_delete/word_prefix_pair_proximity_docids.snap +++ b/milli/src/update/prefix_word_pairs/snapshots/mod.rs/hard_delete_and_reupdate/second_delete/word_prefix_pair_proximity_docids.snap @@ -7,5 +7,4 @@ source: milli/src/update/prefix_word_pairs/mod.rs 2 bell a [51, ] 3 rings a [51, ] 3 the a [51, ] -4 bell a [51, ] diff --git a/milli/src/update/prefix_word_pairs/snapshots/mod.rs/soft_delete_and_reupdate/first_delete/word_prefix_pair_proximity_docids.snap b/milli/src/update/prefix_word_pairs/snapshots/mod.rs/soft_delete_and_reupdate/first_delete/word_prefix_pair_proximity_docids.snap index e55ebed9d..885985bdf 100644 --- a/milli/src/update/prefix_word_pairs/snapshots/mod.rs/soft_delete_and_reupdate/first_delete/word_prefix_pair_proximity_docids.snap +++ b/milli/src/update/prefix_word_pairs/snapshots/mod.rs/soft_delete_and_reupdate/first_delete/word_prefix_pair_proximity_docids.snap @@ -12,5 +12,4 @@ source: milli/src/update/prefix_word_pairs/mod.rs 3 at a [50, ] 3 rings a [51, ] 3 the a [51, ] -4 bell a [51, ] diff --git a/milli/src/update/prefix_word_pairs/snapshots/mod.rs/soft_delete_and_reupdate/initial/word_prefix_pair_proximity_docids.snap b/milli/src/update/prefix_word_pairs/snapshots/mod.rs/soft_delete_and_reupdate/initial/word_prefix_pair_proximity_docids.snap index e55ebed9d..885985bdf 100644 --- a/milli/src/update/prefix_word_pairs/snapshots/mod.rs/soft_delete_and_reupdate/initial/word_prefix_pair_proximity_docids.snap +++ b/milli/src/update/prefix_word_pairs/snapshots/mod.rs/soft_delete_and_reupdate/initial/word_prefix_pair_proximity_docids.snap @@ -12,5 +12,4 @@ source: milli/src/update/prefix_word_pairs/mod.rs 3 at a [50, ] 3 rings a [51, ] 3 the a [51, ] -4 bell a [51, ] diff --git a/milli/src/update/prefix_word_pairs/snapshots/mod.rs/soft_delete_and_reupdate/reupdate/word_prefix_pair_proximity_docids.snap b/milli/src/update/prefix_word_pairs/snapshots/mod.rs/soft_delete_and_reupdate/reupdate/word_prefix_pair_proximity_docids.snap index 8a684b16d..2ea0d46f4 100644 --- a/milli/src/update/prefix_word_pairs/snapshots/mod.rs/soft_delete_and_reupdate/reupdate/word_prefix_pair_proximity_docids.snap +++ b/milli/src/update/prefix_word_pairs/snapshots/mod.rs/soft_delete_and_reupdate/reupdate/word_prefix_pair_proximity_docids.snap @@ -16,6 +16,4 @@ source: milli/src/update/prefix_word_pairs/mod.rs 3 at a [50, ] 3 rings a [51, ] 3 the a [51, ] -4 at b [50, ] -4 bell a [51, ] diff --git a/milli/src/update/prefix_word_pairs/snapshots/mod.rs/soft_delete_and_reupdate/second_delete/word_prefix_pair_proximity_docids.snap b/milli/src/update/prefix_word_pairs/snapshots/mod.rs/soft_delete_and_reupdate/second_delete/word_prefix_pair_proximity_docids.snap index e55ebed9d..885985bdf 100644 --- a/milli/src/update/prefix_word_pairs/snapshots/mod.rs/soft_delete_and_reupdate/second_delete/word_prefix_pair_proximity_docids.snap +++ b/milli/src/update/prefix_word_pairs/snapshots/mod.rs/soft_delete_and_reupdate/second_delete/word_prefix_pair_proximity_docids.snap @@ -12,5 +12,4 @@ source: milli/src/update/prefix_word_pairs/mod.rs 3 at a [50, ] 3 rings a [51, ] 3 the a [51, ] -4 bell a [51, ]