mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-09-20 11:46:25 +00:00
Add new tests and fix construction of query graph from paths
This commit is contained in:
@ -3,6 +3,8 @@ This module tests the interactions between the proximity and typo ranking rules.
|
||||
|
||||
The proximity ranking rule should transform the query graph such that it
|
||||
only contains the word pairs that it used to compute its bucket.
|
||||
|
||||
TODO: This is not currently implemented.
|
||||
*/
|
||||
|
||||
use crate::{
|
||||
@ -61,8 +63,13 @@ fn test_trap_basic() {
|
||||
s.terms_matching_strategy(TermsMatchingStrategy::All);
|
||||
s.query("summer holiday");
|
||||
let SearchResult { documents_ids, .. } = s.execute().unwrap();
|
||||
insta::assert_snapshot!(format!("{documents_ids:?}"), @"[1, 0, 3, 2]");
|
||||
insta::assert_snapshot!(format!("{documents_ids:?}"), @"[0, 1]");
|
||||
let texts = collect_field_values(&index, &txn, "text", &documents_ids);
|
||||
// TODO: this is incorrect, 1 should come before 0
|
||||
insta::assert_debug_snapshot!(texts, @r###"
|
||||
[
|
||||
"\"summer. holiday. sommer holidty\"",
|
||||
"\"summer. holiday. sommer holiday\"",
|
||||
]
|
||||
"###);
|
||||
}
|
||||
|
@ -271,13 +271,13 @@ fn test_sort() {
|
||||
"false",
|
||||
"true",
|
||||
"true",
|
||||
"__does_not_exist___",
|
||||
"__does_not_exist__",
|
||||
"null",
|
||||
"[null,null,\"\"]",
|
||||
"\"\"",
|
||||
"{\"sub\":0}",
|
||||
"__does_not_exist___",
|
||||
"__does_not_exist___",
|
||||
"__does_not_exist__",
|
||||
"__does_not_exist__",
|
||||
]
|
||||
"###);
|
||||
|
||||
@ -304,13 +304,13 @@ fn test_sort() {
|
||||
"false",
|
||||
"\"1\"",
|
||||
"\"0\"",
|
||||
"__does_not_exist___",
|
||||
"__does_not_exist__",
|
||||
"null",
|
||||
"[null,null,\"\"]",
|
||||
"\"\"",
|
||||
"{\"sub\":0}",
|
||||
"__does_not_exist___",
|
||||
"__does_not_exist___",
|
||||
"__does_not_exist__",
|
||||
"__does_not_exist__",
|
||||
]
|
||||
"###);
|
||||
}
|
||||
|
@ -59,8 +59,7 @@ fn create_index() -> TempIndex {
|
||||
"id": 3,
|
||||
"text": "beautiful sommer"
|
||||
},
|
||||
// The next two documents lay out an even more complex trap, which the current implementation
|
||||
// fails to handle properly.
|
||||
// The next two documents lay out an even more complex trap.
|
||||
// With the user query `delicious sweet dessert`, the typo ranking rule will return one bucket of:
|
||||
// - id 4: delicitous + sweet + dessert
|
||||
// - id 5: beautiful + sweet + desgert
|
||||
@ -114,13 +113,12 @@ fn test_trap_complex2() {
|
||||
s.terms_matching_strategy(TermsMatchingStrategy::All);
|
||||
s.query("delicious sweet dessert");
|
||||
let SearchResult { documents_ids, .. } = s.execute().unwrap();
|
||||
insta::assert_snapshot!(format!("{documents_ids:?}"), @"[4, 5]");
|
||||
insta::assert_snapshot!(format!("{documents_ids:?}"), @"[5, 4]");
|
||||
let texts = collect_field_values(&index, &txn, "text", &documents_ids);
|
||||
// TODO: this is incorrect. 5 should appear before 4
|
||||
insta::assert_debug_snapshot!(texts, @r###"
|
||||
[
|
||||
"\"delicitous. sweet. dessert. delicitous sweet desgert\"",
|
||||
"\"delicious. sweet desgert. delicious sweet desgert\"",
|
||||
"\"delicitous. sweet. dessert. delicitous sweet desgert\"",
|
||||
]
|
||||
"###);
|
||||
}
|
||||
|
Reference in New Issue
Block a user