From 76d7f20c87ef1bb0620480cd64bb533bf46962cd Mon Sep 17 00:00:00 2001 From: Louis Dureuil Date: Wed, 15 Oct 2025 17:07:54 +0200 Subject: [PATCH] fix snap --- crates/milli/src/search/new/tests/cutoff.rs | 74 ++++++++++++++++++++- 1 file changed, 71 insertions(+), 3 deletions(-) diff --git a/crates/milli/src/search/new/tests/cutoff.rs b/crates/milli/src/search/new/tests/cutoff.rs index f2dfb45d6..6e8260ef3 100644 --- a/crates/milli/src/search/new/tests/cutoff.rs +++ b/crates/milli/src/search/new/tests/cutoff.rs @@ -361,9 +361,8 @@ fn degraded_search_and_score_details() { ] "###); - // 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. - search.time_budget(TimeBudget::max().with_stop_after(6)); + // After FIVE loop iterations. The words ranking rule gave us a new bucket. + search.time_budget(TimeBudget::max().with_stop_after(5)); let result = search.execute().unwrap(); snapshot!(format!("IDs: {:?}\nScores: {}\nScore Details:\n{:#?}", result.documents_ids, result.document_scores.iter().map(|scores| format!("{:.4} ", ScoreDetails::global_score(scores.iter()))).collect::(), result.document_scores), @r###" @@ -424,4 +423,73 @@ fn degraded_search_and_score_details() { ], ] "###); + + // After SIX loop iterations. + // we finished + search.time_budget(TimeBudget::max().with_stop_after(6)); + + let result = search.execute().unwrap(); + snapshot!(format!("IDs: {:?}\nScores: {}\nScore Details:\n{:#?}", result.documents_ids, result.document_scores.iter().map(|scores| format!("{:.4} ", ScoreDetails::global_score(scores.iter()))).collect::(), result.document_scores), @r###" + IDs: [4, 1, 0, 3] + Scores: 1.0000 0.9167 0.8333 0.6667 + Score Details: + [ + [ + Words( + Words { + matching_words: 3, + max_matching_words: 3, + }, + ), + Typo( + Typo { + typo_count: 0, + max_typo_count: 3, + }, + ), + ], + [ + Words( + Words { + matching_words: 3, + max_matching_words: 3, + }, + ), + Typo( + Typo { + typo_count: 1, + max_typo_count: 3, + }, + ), + ], + [ + Words( + Words { + matching_words: 3, + max_matching_words: 3, + }, + ), + Typo( + Typo { + typo_count: 2, + max_typo_count: 3, + }, + ), + ], + [ + Words( + Words { + matching_words: 2, + max_matching_words: 3, + }, + ), + Typo( + Typo { + typo_count: 0, + max_typo_count: 2, + }, + ), + ], + ] + "###); }