add test normalize exact words

This commit is contained in:
ad hoc 2022-04-21 13:52:09 +02:00
parent c7d0097c97
commit 3a2451fcba
No known key found for this signature in database
GPG Key ID: 4F00A782990CC643

View File

@ -1461,4 +1461,22 @@ mod tests {
builder.set_min_word_len_two_typos(7); builder.set_min_word_len_two_typos(7);
assert!(builder.execute(|_| ()).is_err()); assert!(builder.execute(|_| ()).is_err());
} }
#[test]
fn update_exact_words_normalization() {
let index = TempIndex::new();
let config = IndexerConfig::default();
// Set the genres setting
let mut txn = index.write_txn().unwrap();
let mut builder = Settings::new(&mut txn, &index, &config);
let words = btreeset! { S("Ab"), S("ac") };
builder.set_exact_words(words);
assert!(builder.execute(|_| ()).is_ok());
let exact_words = index.exact_words(&txn).unwrap();
for word in exact_words.into_fst().stream().into_str_vec().unwrap() {
assert!(word.0 == "ac" || word.0 == "ab");
}
}
} }