mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-12-24 13:40:31 +01:00
Small code cleanup
This commit is contained in:
parent
78b9304d52
commit
9ec9c204d3
@ -80,7 +80,7 @@ pub fn word_derivations(
|
|||||||
word: &str,
|
word: &str,
|
||||||
max_typo: u8,
|
max_typo: u8,
|
||||||
is_prefix: bool,
|
is_prefix: bool,
|
||||||
) -> Result<WordDerivations> {
|
) -> Result<Interned<WordDerivations>> {
|
||||||
let fst = ctx.index.words_fst(ctx.txn)?;
|
let fst = ctx.index.words_fst(ctx.txn)?;
|
||||||
let word_interned = ctx.word_interner.insert(word.to_owned());
|
let word_interned = ctx.word_interner.insert(word.to_owned());
|
||||||
|
|
||||||
@ -185,7 +185,7 @@ pub fn word_derivations(
|
|||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
Ok(WordDerivations {
|
let interned = ctx.derivations_interner.insert(WordDerivations {
|
||||||
original: ctx.word_interner.insert(word.to_owned()),
|
original: ctx.word_interner.insert(word.to_owned()),
|
||||||
synonyms,
|
synonyms,
|
||||||
split_words,
|
split_words,
|
||||||
@ -193,7 +193,9 @@ pub fn word_derivations(
|
|||||||
one_typo: one_typo.into_boxed_slice(),
|
one_typo: one_typo.into_boxed_slice(),
|
||||||
two_typos: two_typos.into_boxed_slice(),
|
two_typos: two_typos.into_boxed_slice(),
|
||||||
use_prefix_db,
|
use_prefix_db,
|
||||||
})
|
});
|
||||||
|
|
||||||
|
Ok(interned)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Split the original word into the two words that appear the
|
/// Split the original word into the two words that appear the
|
||||||
@ -342,9 +344,7 @@ pub fn located_query_terms_from_string<'search>(
|
|||||||
let word = token.lemma();
|
let word = token.lemma();
|
||||||
let derivations = word_derivations(ctx, word, nbr_typos(word), false)?;
|
let derivations = word_derivations(ctx, word, nbr_typos(word), false)?;
|
||||||
let located_term = LocatedQueryTerm {
|
let located_term = LocatedQueryTerm {
|
||||||
value: QueryTerm::Word {
|
value: QueryTerm::Word { derivations },
|
||||||
derivations: ctx.derivations_interner.insert(derivations),
|
|
||||||
},
|
|
||||||
positions: position..=position,
|
positions: position..=position,
|
||||||
};
|
};
|
||||||
located_terms.push(located_term);
|
located_terms.push(located_term);
|
||||||
@ -355,9 +355,7 @@ pub fn located_query_terms_from_string<'search>(
|
|||||||
let word = token.lemma();
|
let word = token.lemma();
|
||||||
let derivations = word_derivations(ctx, word, nbr_typos(word), true)?;
|
let derivations = word_derivations(ctx, word, nbr_typos(word), true)?;
|
||||||
let located_term = LocatedQueryTerm {
|
let located_term = LocatedQueryTerm {
|
||||||
value: QueryTerm::Word {
|
value: QueryTerm::Word { derivations },
|
||||||
derivations: ctx.derivations_interner.insert(derivations),
|
|
||||||
},
|
|
||||||
positions: position..=position,
|
positions: position..=position,
|
||||||
};
|
};
|
||||||
located_terms.push(located_term);
|
located_terms.push(located_term);
|
||||||
|
@ -150,6 +150,7 @@ pub fn resolve_query_graph<'search>(
|
|||||||
phrase_interner,
|
phrase_interner,
|
||||||
derivations_interner,
|
derivations_interner,
|
||||||
query_term_docids,
|
query_term_docids,
|
||||||
|
..
|
||||||
} = ctx;
|
} = ctx;
|
||||||
// TODO: there is a faster way to compute this big
|
// TODO: there is a faster way to compute this big
|
||||||
// roaring bitmap expression
|
// roaring bitmap expression
|
||||||
|
Loading…
x
Reference in New Issue
Block a user