3 ms·
How big is the website? This was a while ago so maybe there's better libraries for it but I've integrated https://lunrjs.com/ https://lunrjs.com/ before for se
by seanwilson 5y ago
How big is the website?
This was a while ago so maybe there's better libraries for it but I've integrated https://lunrjs.com/ https://lunrjs.com/ before for searching a few 100 FAQs with lengthy answers. You create a static search index file of your articles at build time that's served to the client (it was ~20KB compressed) to search with using JavaScript.
The indexing file will grow with the number of documents you have but not sure at what stage this approach becomes impractical (does anyone have any benchmarks?). Worth looking into because you can create a completely custom search UI that updates instantly plus there's nothing extra to host or pay for as it's all static.
Edit: This lists similar libraries plus benchmarks: https://github.com/nextapps-de/flexsearch https://github.com/nextapps-de/flexsearch
- rococode 5y agoThere's also Elasticlunr which is based off of lunr.js and is what mdBook uses http://elasticlunr.com/ http://elasticlunr.com/