mattico / elasticlunr-rs

A partial port of elasticlunr to Rust. Intended to be used for generating compatible search indices.
Apache License 2.0
52 stars 23 forks source link

Stack overflow for very long words #44

Open mattheww opened 2 years ago

mattheww commented 2 years ago

If I add a very long word to the index (8000 characters is enough on my machine), I get a stack overflow while serialising it.

Here's how I was testing:

fn main() {
    let mut index = Index::new(&["body"]);
    let long_string = "a".repeat(8000);
    index.add_doc("1", &[long_string]);
    index.to_json_pretty();
}
mattico commented 2 years ago

I suggest you use https://github.com/dtolnay/serde-stacker to convert the index to JSON. I don't think I want to make this the default behavior.