From bf750e45a11031c33f746f34224439bbdfaca46b Mon Sep 17 00:00:00 2001 From: ManyTheFish Date: Thu, 1 Sep 2022 12:10:47 +0200 Subject: [PATCH] Fix word removal issue --- milli/src/search/query_tree.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/milli/src/search/query_tree.rs b/milli/src/search/query_tree.rs index 5fd004c99..1c60e41f7 100644 --- a/milli/src/search/query_tree.rs +++ b/milli/src/search/query_tree.rs @@ -1,5 +1,5 @@ use std::borrow::Cow; -use std::cmp::min; +use std::cmp::max; use std::{cmp, fmt, mem}; use charabia::classifier::ClassifiedTokenIter; @@ -450,14 +450,14 @@ fn create_query_tree( } let number_phrases = query.iter().filter(|p| p.is_phrase()).count(); - let remove_count = query.len() - min(number_phrases, 1); + let remove_count = query.len() - max(number_phrases, 1); if remove_count == 0 { return ngrams(ctx, authorize_typos, query, false); } let mut operation_children = Vec::new(); let mut query = query.to_vec(); - for _ in 0..remove_count { + for _ in 0..=remove_count { let pos = match terms_matching_strategy { TermsMatchingStrategy::All => return ngrams(ctx, authorize_typos, &query, false), TermsMatchingStrategy::Any => {