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

Fully port elasticlunr to rust as a wasm module? #43

Closed Jieiku closed 2 years ago

Jieiku commented 2 years ago

My understanding is that elasticlunr-rs provides a way to use rust to build the search index (which is what zola uses this for)

Then zola uses the regular elasticlunr.js for web search, search box here: https://www.getzola.org/themes/

There are two rust(WASM) based searches stork and tinysearch, but it seems elasticlunr is more complete in terms of CJK/stemmers/stopwords.

My experience with WASM is very minimal, but I would think this may reduce the size of the index/search module and because its in WebAssembly I would think it would be more performant than the javascript based elasticlunr, currently my search has zero performance issues, but I am wondering how it would do on a very large site, you can see my current implementation here: https://abridge.netlify.app/ (search for zola and press enter or the search icon)

I could be wrong about some of this as my experience with WASM is minimal, so any information is appreciated.

mattico commented 2 years ago

Adding better language support to either of those searchers should be easier than adding a search implementation to this and porting it to WASM.

I also have minimal experience with WASM, but I would expect that elasticlunr's index design is not good for being sped up by WASM. The index is a series of nested maps. I'd expect map lookup to be highly optimized in JavaScript since it's so fundamental to the language. You could try to create an alternate index format but that's outside the scope of this crate.

I'm not particularly interested in implementing this, nor in supporting someone else's implementation. No harm in asking though!

Jieiku commented 2 years ago

Thank you for taking the time to write a detailed explanation, I now have a much better understanding of the situation.