mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-23 02:27:40 +08:00
Update tests
This commit is contained in:
parent
882ab9cc85
commit
1f36410541
@ -371,7 +371,7 @@ fn test_proximity_prefix_db() {
|
|||||||
s.scoring_strategy(crate::score_details::ScoringStrategy::Detailed);
|
s.scoring_strategy(crate::score_details::ScoringStrategy::Detailed);
|
||||||
s.query("best s");
|
s.query("best s");
|
||||||
let SearchResult { documents_ids, document_scores, .. } = s.execute().unwrap();
|
let SearchResult { documents_ids, document_scores, .. } = s.execute().unwrap();
|
||||||
insta::assert_snapshot!(format!("{documents_ids:?}"), @"[10, 13, 9, 12, 6, 7, 8, 11, 15]");
|
insta::assert_snapshot!(format!("{documents_ids:?}"), @"[10, 9, 6, 7, 8, 11, 12, 13, 15]");
|
||||||
insta::assert_snapshot!(format!("{document_scores:#?}"));
|
insta::assert_snapshot!(format!("{document_scores:#?}"));
|
||||||
let texts = collect_field_values(&index, &txn, "text", &documents_ids);
|
let texts = collect_field_values(&index, &txn, "text", &documents_ids);
|
||||||
|
|
||||||
@ -379,13 +379,13 @@ fn test_proximity_prefix_db() {
|
|||||||
insta::assert_debug_snapshot!(texts, @r###"
|
insta::assert_debug_snapshot!(texts, @r###"
|
||||||
[
|
[
|
||||||
"\"this is the best summer meal\"",
|
"\"this is the best summer meal\"",
|
||||||
"\"summer best\"",
|
|
||||||
"\"this is the best meal of summer\"",
|
"\"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 meal I have ever had in such a beautiful summer day\"",
|
||||||
"\"this is the best cooked meal of the summer\"",
|
"\"this is the best cooked meal of the summer\"",
|
||||||
"\"this is the best meal of the summer\"",
|
"\"this is the best meal of the summer\"",
|
||||||
"\"summer x y best\"",
|
"\"summer x y best\"",
|
||||||
|
"\"summer x best\"",
|
||||||
|
"\"summer best\"",
|
||||||
"\"this is the best meal I have ever had in such a beautiful winter day\"",
|
"\"this is the best meal I have ever had in such a beautiful winter day\"",
|
||||||
]
|
]
|
||||||
"###);
|
"###);
|
||||||
@ -423,20 +423,20 @@ fn test_proximity_prefix_db() {
|
|||||||
s.scoring_strategy(crate::score_details::ScoringStrategy::Detailed);
|
s.scoring_strategy(crate::score_details::ScoringStrategy::Detailed);
|
||||||
s.query("best win");
|
s.query("best win");
|
||||||
let SearchResult { documents_ids, document_scores, .. } = s.execute().unwrap();
|
let SearchResult { documents_ids, document_scores, .. } = s.execute().unwrap();
|
||||||
insta::assert_snapshot!(format!("{documents_ids:?}"), @"[19, 22, 18, 21, 15, 16, 17, 20]");
|
insta::assert_snapshot!(format!("{documents_ids:?}"), @"[19, 18, 15, 16, 17, 20, 21, 22]");
|
||||||
insta::assert_snapshot!(format!("{document_scores:#?}"));
|
insta::assert_snapshot!(format!("{document_scores:#?}"));
|
||||||
let texts = collect_field_values(&index, &txn, "text", &documents_ids);
|
let texts = collect_field_values(&index, &txn, "text", &documents_ids);
|
||||||
|
|
||||||
insta::assert_debug_snapshot!(texts, @r###"
|
insta::assert_debug_snapshot!(texts, @r###"
|
||||||
[
|
[
|
||||||
"\"this is the best winter meal\"",
|
"\"this is the best winter meal\"",
|
||||||
"\"winter best\"",
|
|
||||||
"\"this is the best meal of winter\"",
|
"\"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 meal I have ever had in such a beautiful winter day\"",
|
||||||
"\"this is the best cooked meal of the winter\"",
|
"\"this is the best cooked meal of the winter\"",
|
||||||
"\"this is the best meal of the winter\"",
|
"\"this is the best meal of the winter\"",
|
||||||
"\"winter x y best\"",
|
"\"winter x y best\"",
|
||||||
|
"\"winter x best\"",
|
||||||
|
"\"winter best\"",
|
||||||
]
|
]
|
||||||
"###);
|
"###);
|
||||||
|
|
||||||
@ -471,20 +471,20 @@ fn test_proximity_prefix_db() {
|
|||||||
s.scoring_strategy(crate::score_details::ScoringStrategy::Detailed);
|
s.scoring_strategy(crate::score_details::ScoringStrategy::Detailed);
|
||||||
s.query("best wi");
|
s.query("best wi");
|
||||||
let SearchResult { documents_ids, document_scores, .. } = s.execute().unwrap();
|
let SearchResult { documents_ids, document_scores, .. } = s.execute().unwrap();
|
||||||
insta::assert_snapshot!(format!("{documents_ids:?}"), @"[19, 22, 18, 21, 15, 16, 17, 20]");
|
insta::assert_snapshot!(format!("{documents_ids:?}"), @"[19, 18, 15, 16, 17, 20, 21, 22]");
|
||||||
insta::assert_snapshot!(format!("{document_scores:#?}"));
|
insta::assert_snapshot!(format!("{document_scores:#?}"));
|
||||||
let texts = collect_field_values(&index, &txn, "text", &documents_ids);
|
let texts = collect_field_values(&index, &txn, "text", &documents_ids);
|
||||||
|
|
||||||
insta::assert_debug_snapshot!(texts, @r###"
|
insta::assert_debug_snapshot!(texts, @r###"
|
||||||
[
|
[
|
||||||
"\"this is the best winter meal\"",
|
"\"this is the best winter meal\"",
|
||||||
"\"winter best\"",
|
|
||||||
"\"this is the best meal of winter\"",
|
"\"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 meal I have ever had in such a beautiful winter day\"",
|
||||||
"\"this is the best cooked meal of the winter\"",
|
"\"this is the best cooked meal of the winter\"",
|
||||||
"\"this is the best meal of the winter\"",
|
"\"this is the best meal of the winter\"",
|
||||||
"\"winter x y best\"",
|
"\"winter x y best\"",
|
||||||
|
"\"winter x best\"",
|
||||||
|
"\"winter best\"",
|
||||||
]
|
]
|
||||||
"###);
|
"###);
|
||||||
}
|
}
|
||||||
|
@ -11,14 +11,6 @@ expression: "format!(\"{document_scores:#?}\")"
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
[
|
|
||||||
Proximity(
|
|
||||||
Rank {
|
|
||||||
rank: 3,
|
|
||||||
max_rank: 4,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
[
|
[
|
||||||
Proximity(
|
Proximity(
|
||||||
Rank {
|
Rank {
|
||||||
@ -30,7 +22,15 @@ expression: "format!(\"{document_scores:#?}\")"
|
|||||||
[
|
[
|
||||||
Proximity(
|
Proximity(
|
||||||
Rank {
|
Rank {
|
||||||
rank: 2,
|
rank: 1,
|
||||||
|
max_rank: 4,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
[
|
||||||
|
Proximity(
|
||||||
|
Rank {
|
||||||
|
rank: 1,
|
||||||
max_rank: 4,
|
max_rank: 4,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
@ -11,14 +11,6 @@ expression: "format!(\"{document_scores:#?}\")"
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
[
|
|
||||||
Proximity(
|
|
||||||
Rank {
|
|
||||||
rank: 3,
|
|
||||||
max_rank: 4,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
[
|
[
|
||||||
Proximity(
|
Proximity(
|
||||||
Rank {
|
Rank {
|
||||||
@ -30,7 +22,15 @@ expression: "format!(\"{document_scores:#?}\")"
|
|||||||
[
|
[
|
||||||
Proximity(
|
Proximity(
|
||||||
Rank {
|
Rank {
|
||||||
rank: 2,
|
rank: 1,
|
||||||
|
max_rank: 4,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
[
|
||||||
|
Proximity(
|
||||||
|
Rank {
|
||||||
|
rank: 1,
|
||||||
max_rank: 4,
|
max_rank: 4,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
@ -11,14 +11,6 @@ expression: "format!(\"{document_scores:#?}\")"
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
[
|
|
||||||
Proximity(
|
|
||||||
Rank {
|
|
||||||
rank: 3,
|
|
||||||
max_rank: 4,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
[
|
[
|
||||||
Proximity(
|
Proximity(
|
||||||
Rank {
|
Rank {
|
||||||
@ -30,7 +22,15 @@ expression: "format!(\"{document_scores:#?}\")"
|
|||||||
[
|
[
|
||||||
Proximity(
|
Proximity(
|
||||||
Rank {
|
Rank {
|
||||||
rank: 2,
|
rank: 1,
|
||||||
|
max_rank: 4,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
[
|
||||||
|
Proximity(
|
||||||
|
Rank {
|
||||||
|
rank: 1,
|
||||||
max_rank: 4,
|
max_rank: 4,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
@ -219,22 +219,6 @@ pub fn snap_word_pair_proximity_docids(index: &Index) -> String {
|
|||||||
&format!("{proximity:<2} {word1:<16} {word2:<16} {}", display_bitmap(&b))
|
&format!("{proximity:<2} {word1:<16} {word2:<16} {}", display_bitmap(&b))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
pub fn snap_word_prefix_pair_proximity_docids(index: &Index) -> String {
|
|
||||||
make_db_snap_from_iter!(index, word_prefix_pair_proximity_docids, |(
|
|
||||||
(proximity, word1, prefix),
|
|
||||||
b,
|
|
||||||
)| {
|
|
||||||
&format!("{proximity:<2} {word1:<16} {prefix:<4} {}", display_bitmap(&b))
|
|
||||||
})
|
|
||||||
}
|
|
||||||
pub fn snap_prefix_word_pair_proximity_docids(index: &Index) -> String {
|
|
||||||
make_db_snap_from_iter!(index, prefix_word_pair_proximity_docids, |(
|
|
||||||
(proximity, prefix, word2),
|
|
||||||
b,
|
|
||||||
)| {
|
|
||||||
&format!("{proximity:<2} {prefix:<4} {word2:<16} {}", display_bitmap(&b))
|
|
||||||
})
|
|
||||||
}
|
|
||||||
pub fn snap_word_position_docids(index: &Index) -> String {
|
pub fn snap_word_position_docids(index: &Index) -> String {
|
||||||
make_db_snap_from_iter!(index, word_position_docids, |((word, position), b)| {
|
make_db_snap_from_iter!(index, word_position_docids, |((word, position), b)| {
|
||||||
&format!("{word:<16} {position:<6} {}", display_bitmap(&b))
|
&format!("{word:<16} {position:<6} {}", display_bitmap(&b))
|
||||||
|
Loading…
Reference in New Issue
Block a user