Use Lunr for search
Context and Problem Statement¶
We have to provide a search bar to perform full-text search on ADRs.
Decision Drivers ¶
- Works in preview mode AND in the statically built version
- Provides good fuzzy search and stemming capabilities
- Is fast enough to be able to show results while typing
- Does not consume too much CPU and RAM on the client-side, especially for the statically built version
Considered Options¶
- Option 1: Fuse.js
- Option 2: Lunr.js
Decision Outcome¶
Chosen option: "Option 2: Lunr.js".
Pros and Cons of the Options ¶
Option 1: Fuse.js¶
- Fast indexing
- Slow searching
- Only fuzzy search, no stemming
Option 2: Lunr.js¶
- Slow indexing, but supports index serialization to pre-build them
- Fast searching
- Stemming, multi-language support
- Retrieves the position of the matched tokens