mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-22 21:04:27 +01:00
Add test for phrase search with stop words and all criteria at once
Moved the actual test into a separate function used by both the existing test and the new test.
This commit is contained in:
parent
77f1ff019b
commit
f1da623af3
@ -1,5 +1,6 @@
|
|||||||
|
use crate::search::Criterion::{Attribute, Exactness, Proximity};
|
||||||
use milli::update::{IndexerConfig, Settings};
|
use milli::update::{IndexerConfig, Settings};
|
||||||
use milli::{Index, Search, TermsMatchingStrategy};
|
use milli::{Criterion, Index, Search, TermsMatchingStrategy};
|
||||||
|
|
||||||
fn set_stop_words(index: &Index, stop_words: &[&str]) {
|
fn set_stop_words(index: &Index, stop_words: &[&str]) {
|
||||||
let mut wtxn = index.write_txn().unwrap();
|
let mut wtxn = index.write_txn().unwrap();
|
||||||
@ -12,9 +13,7 @@ fn set_stop_words(index: &Index, stop_words: &[&str]) {
|
|||||||
wtxn.commit().unwrap();
|
wtxn.commit().unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
fn test_phrase_search_with_stop_words_given_criteria(criteria: &[Criterion]) {
|
||||||
fn test_phrase_search_with_stop_words() {
|
|
||||||
let criteria = [];
|
|
||||||
let index = super::setup_search_index_with_criteria(&criteria);
|
let index = super::setup_search_index_with_criteria(&criteria);
|
||||||
|
|
||||||
// Add stop_words
|
// Add stop_words
|
||||||
@ -42,3 +41,15 @@ fn test_phrase_search_with_stop_words() {
|
|||||||
let result = search.execute().unwrap();
|
let result = search.execute().unwrap();
|
||||||
assert_eq!(result.documents_ids.len(), 0);
|
assert_eq!(result.documents_ids.len(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_phrase_search_with_stop_words_no_criteria() {
|
||||||
|
let criteria = [];
|
||||||
|
test_phrase_search_with_stop_words_given_criteria(&criteria);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_phrase_search_with_stop_words_all_criteria() {
|
||||||
|
let criteria = [Proximity, Attribute, Exactness];
|
||||||
|
test_phrase_search_with_stop_words_given_criteria(&criteria);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user