Don't create partial matching words for synonyms in ngrams

This commit is contained in:
Loïc Lecrenier 2022-11-28 16:32:28 +01:00
parent f70856bab1
commit 61b58b115a

View File

@ -693,13 +693,15 @@ fn create_matching_words(
if let Some(synonyms) = ctx.synonyms(&words)? { if let Some(synonyms) = ctx.synonyms(&words)? {
for synonym in synonyms { for synonym in synonyms {
let synonym = synonym if let Some(synonym) = synonym
.into_iter() .into_iter()
.flat_map(|syn| matching_word_cache.insert(syn, 0, false)) .map(|syn| matching_word_cache.insert(syn, 0, false))
.collect(); .collect()
{
matching_words.push((synonym, ids.clone())); matching_words.push((synonym, ids.clone()));
} }
} }
}
let word = words.concat(); let word = words.concat();
let (word_len_one_typo, word_len_two_typo) = let (word_len_one_typo, word_len_two_typo) =
ctx.min_word_len_for_typo()?; ctx.min_word_len_for_typo()?;