mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-23 10:37:41 +08:00
review changes
This commit is contained in:
parent
69dc4de80f
commit
25fc576696
@ -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)?,
|
||||
})
|
||||
}
|
||||
|
||||
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user