Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Commit

Permalink
review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
MarinPostma committed May 24, 2022
1 parent 69dc4de commit 25fc576
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions milli/src/search/query_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Self> {
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)?,
})
}

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 25fc576

Please sign in to comment.