This is a lightweight, fast, full-text search engine for static websites. I'm using it on my homepage if you like to see a quick demo.
It is a Rust/WASM port of the Python code from the article "Writing a full-text search engine using Bloom filters". This can be seen as an alternative to lunr.js and elasticlunr.
The idea is to generate a small, self-contained WASM module from a list of articles of a website and ship it to browsers. tinysearch could be integrated into the build process of generators like Jekyll, Hugo, zola, or Cobalt.
- Only searches for entire words. There are no search suggestions.
- Since we bundle all search indices for all articles into one static binary, we recommend to only use it for low- to medium-size websites. Expect around 4kB (non-compressed) per article.
wasm-pack is required to build the WASM module. Install it with
cargo install wasm-pack
npm install terser -g
If you want to make the WebAssembly as small as possible, we recommend that you install binaryen as well. On macOS you can install it using homebrew like so:
brew install binaryen
Alternatively you can download the binary from the release page or use your OS package manager.
After that, you can install tinysearch itself:
cargo install tinysearch
As an input, we require a JSON file, which contains a list of your blog posts (see file format).
your homepage. You can open the
demo.html with any webserver to see the
For example, if you have Python installed, you can try the following:
python -m SimpleHTTPServer
then browse to http://0.0.0.0:8000/demo.html
For advanced usage options, try
- Matthias Endler (@mre)
- Jorge-Luis Betancourt (@jorgelbg)
tinysearch is licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.