Add a test to make sure that long words are correctly skipped

This commit is contained in:
Kerollmops 2022-09-07 14:11:44 +02:00
parent b9539c59f3
commit c83c3cd796
No known key found for this signature in database
GPG Key ID: 92ADA4E935E71FA4

View File

@ -1741,4 +1741,22 @@ mod tests {
index.add_documents(doc3).unwrap_err(); index.add_documents(doc3).unwrap_err();
index.add_documents(doc4).unwrap_err(); index.add_documents(doc4).unwrap_err();
} }
#[test]
fn long_words_must_be_skipped() {
let index = TempIndex::new();
// this is obviousy too long
let long_word = "lol".repeat(1000);
let doc1 = documents! {[{
"id": "1",
"title": long_word.clone(),
}]};
index.add_documents(doc1).unwrap();
let rtxn = index.read_txn().unwrap();
let words_fst = index.words_fst(&rtxn).unwrap();
assert!(!words_fst.contains(&long_word));
}
} }