diff --git a/milli/src/search/query_tree.rs b/milli/src/search/query_tree.rs index 7d2390b39..76748179b 100644 --- a/milli/src/search/query_tree.rs +++ b/milli/src/search/query_tree.rs @@ -193,14 +193,13 @@ impl<'a> QueryTreeBuilder<'a> { /// Create a `QueryTreeBuilder` from a heed ReadOnly transaction `rtxn` /// and an Index `index`. pub fn new(rtxn: &'a heed::RoTxn<'a>, index: &'a Index) -> Result { - let exact_words = index.exact_words(rtxn)?; Ok(Self { rtxn, index, optional_words: true, authorize_typos: true, words_limit: None, - exact_words, + exact_words: index.exact_words(rtxn)?, }) } @@ -292,7 +291,7 @@ pub struct TypoConfig<'a> { /// Return the `QueryKind` of a word depending on `authorize_typos` /// and the provided word length. fn typos<'a>(word: String, authorize_typos: bool, config: TypoConfig<'a>) -> QueryKind { - if authorize_typos && !config.exact_words.as_ref().map(|s| s.contains(&word)).unwrap_or(false) { + if authorize_typos && !config.exact_words.map_or(false, |s| s.contains(&word)) { let count = word.chars().count().min(u8::MAX as usize) as u8; if count < config.word_len_one_typo { QueryKind::exact(word)