mirror of
				https://github.com/meilisearch/meilisearch.git
				synced 2025-10-31 07:56:28 +00: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:
		| @@ -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); | ||||||
|  | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user