Fix synonyms normalization

This commit is contained in:
Kerollmops 2023-09-04 14:39:52 +02:00
parent 085aad0a94
commit 8ac5b765bc
No known key found for this signature in database
GPG Key ID: F250A4C4E3AE5F5F

View File

@ -573,7 +573,7 @@ impl<'a, 't, 'u, 'i> Settings<'a, 't, 'u, 'i> {
tokenizer
.tokenize(text)
.filter_map(|token| {
if token.is_word() {
if token.is_word() && !token.lemma().is_empty() {
Some(token.lemma().to_string())
} else {
None
@ -1443,7 +1443,7 @@ mod tests {
index
.update_settings_using_wtxn(&mut wtxn, |settings| {
settings.set_synonyms(btreemap! {
"japanese".to_string() => vec!["ญี่ปุ่น", "ยี่ปุ่น"],
"japanese".to_string() => vec![S("ญี่ปุ่น"), S("ยี่ปุ่น")],
});
})
.unwrap();