query the detailed score detail in the test

This commit is contained in:
Tamo 2024-03-19 18:07:11 +01:00
parent 098ab594eb
commit 2c3af8e513

View File

@ -10,6 +10,7 @@ use maplit::hashset;
use meili_snap::snapshot; use meili_snap::snapshot;
use crate::index::tests::TempIndex; use crate::index::tests::TempIndex;
use crate::score_details::ScoringStrategy;
use crate::{Criterion, Filter, Search, TimeBudget}; use crate::{Criterion, Filter, Search, TimeBudget};
fn create_index() -> TempIndex { fn create_index() -> TempIndex {
@ -94,6 +95,7 @@ fn degraded_search_and_score_details() {
let mut search = Search::new(&rtxn, &index); let mut search = Search::new(&rtxn, &index);
search.query("hello puppy kefir"); search.query("hello puppy kefir");
search.limit(4); search.limit(4);
search.scoring_strategy(ScoringStrategy::Detailed);
search.time_budget(TimeBudget::max()); search.time_budget(TimeBudget::max());
let result = search.execute().unwrap(); let result = search.execute().unwrap();
@ -140,6 +142,12 @@ fn degraded_search_and_score_details() {
max_matching_words: 3, max_matching_words: 3,
}, },
), ),
Typo(
Typo {
typo_count: 2,
max_typo_count: 3,
},
),
], ],
[ [
Words( Words(
@ -148,6 +156,12 @@ fn degraded_search_and_score_details() {
max_matching_words: 3, max_matching_words: 3,
}, },
), ),
Typo(
Typo {
typo_count: 0,
max_typo_count: 2,
},
),
], ],
] ]
"###); "###);
@ -350,6 +364,12 @@ fn degraded_search_and_score_details() {
max_matching_words: 3, max_matching_words: 3,
}, },
), ),
Typo(
Typo {
typo_count: 2,
max_typo_count: 3,
},
),
], ],
[ [
Skipped, Skipped,
@ -357,9 +377,9 @@ fn degraded_search_and_score_details() {
] ]
"###); "###);
// After FIVE loop iteration. The words ranking rule gave us a new bucket. // After SIX loop iteration. The words ranking rule gave us a new bucket.
// Since we reached the limit we were able to early exit without checking the typo ranking rule. // Since we reached the limit we were able to early exit without checking the typo ranking rule.
search.time_budget(TimeBudget::max().with_stop_after(5)); search.time_budget(TimeBudget::max().with_stop_after(6));
let result = search.execute().unwrap(); let result = search.execute().unwrap();
snapshot!(format!("{:#?}\n{:#?}", result.documents_ids, result.document_scores), @r###" snapshot!(format!("{:#?}\n{:#?}", result.documents_ids, result.document_scores), @r###"
@ -405,6 +425,12 @@ fn degraded_search_and_score_details() {
max_matching_words: 3, max_matching_words: 3,
}, },
), ),
Typo(
Typo {
typo_count: 2,
max_typo_count: 3,
},
),
], ],
[ [
Words( Words(
@ -413,6 +439,7 @@ fn degraded_search_and_score_details() {
max_matching_words: 3, max_matching_words: 3,
}, },
), ),
Skipped,
], ],
] ]
"###); "###);