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

Stable JSON output after replacing HashMaps with BTreeMaps #15

Closed tcr closed 6 years ago

tcr commented 6 years ago

mdBook is a downstream consumer of elasticlunr-rs, and I submitted a patch there to enforce stable ordering of keys when it converts the search index to JSON.

Another way to accomplish this is to force sorted maps in elasticlunr itself by using BTreeSet. (Either solution fixes the downstream issue.) I know that issue #3 says that a trie would be a better replacement though, so no worries if this is too excessive a change just for stable key ordering.

mattico commented 6 years ago

It'll probably be a while before I switch over to a real trie, since it'll be a pain to write the manual serialization code. This seems like a good idea for now.