mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-23 05:14:27 +01:00
Use the minWordSizeForTypos index settings
This commit is contained in:
parent
87e22e436a
commit
e1b8fb48ee
@ -313,13 +313,17 @@ impl<'a> SearchForFacetValues<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
let one_typo = self.search_query.index.min_word_len_one_typo(rtxn)?;
|
||||||
|
let two_typos = self.search_query.index.min_word_len_two_typos(rtxn)?;
|
||||||
|
|
||||||
let is_prefix = true;
|
let is_prefix = true;
|
||||||
let starts = Str::new(get_first(query)).starts_with();
|
let automaton = if query.len() < one_typo as usize {
|
||||||
let first = build_dfa(query, 1, is_prefix)
|
build_dfa(query, 0, is_prefix)
|
||||||
.intersection(starts.clone().complement());
|
} else if query.len() < two_typos as usize {
|
||||||
let second_dfa = build_dfa(query, 2, is_prefix);
|
build_dfa(query, 1, is_prefix)
|
||||||
let second = second_dfa.intersection(starts);
|
} else {
|
||||||
let automaton = first.union(&second);
|
build_dfa(query, 2, is_prefix)
|
||||||
|
};
|
||||||
|
|
||||||
let mut stream = fst.search(automaton).into_stream();
|
let mut stream = fst.search(automaton).into_stream();
|
||||||
let mut length = 0;
|
let mut length = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user