Site Search in Hugo CMS

Search in Hugo

See benchmark results1 2

Search for your Hugo Website | Hugo

Hugo JS Searching with Fuse.js

Fuse.js

Fuse is slow for me.

Client Side Search Engine for Hugo Website
Hugo JS Searching with Fuse.js

Lunr.js

Theme using Lunr is pacollins/hugo-future-imperfect-slim

Not the right way is creating index with node.js like dgrigg/hugo-lunr or stkevintan/hugo-lunr-zh

The right way:

I can pre-build index with node.js but also with PHP GetDKAN/lunr.php

Elasticlunr.js

Based on lunr.js.

Adding search to Hugo with elasticlunr · Camping Coder

FlexSearch.js

fuzzy capabilities are really lousy and plain basic

Typical basic full-text search features include:

tokenization: strings are broken into words differently across languages
stemming: caring for elders matches results for care for elders
stopword handling: avoid irrelevant results caused by common words such as a and the
basic fuzzy matching: service workers matches results for Service Worker

Advanced full-text search features include:

autocomplete: typing progre… invokes suggestions including Progressive Web App
suggestions: typing Porgessive Web Apps suggests Progressive Web Apps
search expressions: enables search to use AND, OR, NOT operators
phrase matching: enables to control how much distance can be allowed between words in a search phrase. For instance, one may configure a search for black friday to match the exact phrase black friday or to match also descriptions that include the words black and friday
synonym search: typing shoes or footwear should return similar results

Most of the benchmarked full-text search libraries provide the aforementioned search basic features. FlexSearch additionally provides advanced features like suggestions, partial matching, phonetic matching, pagination and search expressions. FlexSearch does not however provides synonym search.

chenningg/hugo-flexsearch: A library implementing Flexsearch to enable full text search for Hugo sites.
frjo/hugo-theme-zen implements FlexSearch.js

Alternative string-scoring and fuzzy-matching libraries

Amazing!

Self-hosted fuzzy search engine, like fast-Google, alternative to Algolia, much easier than Elasticsearch, as one binary written in C++: typesense/typesense or similar MeiliSearch


date 10. Dec 2020 | modified 28. May 2021
filename: Hugo CMS » Offline Fuzzy Full-text Search in JavaScript