Add test for indexing a document with a long facet value

This commit is contained in:
Loïc Lecrenier 2022-11-16 15:19:55 +01:00
parent d95d02cb8a
commit 990a861241

View File

@ -1821,4 +1821,24 @@ mod tests {
let words_fst = index.words_fst(&rtxn).unwrap();
assert!(!words_fst.contains(&long_word));
}
#[test]
fn long_facet_values_must_not_crash() {
let index = TempIndex::new();
// this is obviousy too long
let long_word = "lol".repeat(1000);
let doc1 = documents! {[{
"id": "1",
"title": long_word,
}]};
index
.update_settings(|settings| {
settings.set_filterable_fields(hashset! { S("title") });
})
.unwrap();
index.add_documents(doc1).unwrap();
}
}