Search

On this page

The search module integrates HB with the Hugo Search Module, a powerful, flexible and responsive Hugo client side fuzzy search module.

This module can not be imported directly, you’ll need a entry point, such as the search button generated by header’s search module. You can also write your own widget with this module.

Module PathVersion
github.com/razonyang/hb/modules/searchVersion

Site Parameters

NameTypeDefaultDescription
stall_thresholdInteger300How many milliseconds must elapse before considering the autocomplete experience stalled.
case_sensitiveBooleanfalseIndicates whether comparisons should be case sensitive.
min_match_char_lengthInteger1Only the matches whose length exceeds this value will be returned. (For instance, if you want to ignore single character matches in the result, set it to 2).
locationInteger0Determines approximately where in the text is the pattern expected to be found.
thresholdInteger0.6At what point does the match algorithm give up. A threshold of 0.0 requires a perfect match (of both letters and location), a threshold of 1.0 would match anything.
distanceInteger100Determines how close the match must be to the fuzzy location (specified by location). An exact letter match which is distance characters away from the fuzzy location would score as a complete mismatch. A distance of 0 requires the match be at the exact location specified. A distance of 1000 would require a perfect match to be within 800 characters of the location to be found using a threshold of 0.8.
ignore_locationBooleanfalseWhen true, search will ignore location and distance, so it won’t matter where in the string the pattern appears.
shortcut_closeArray["Escape"]Shortcuts to close the search modal. Empty array means disabled. See key values for keyboard events.
shortcut_searchArray["Control", "k"]Shortcuts to open the search modal. Leave it empty to disable.
paginateInteger20How many results per page, at least 20, for making sure the load more event will be able to trigger.
max_resultsInteger100Denotes the max number of returned search results.
index_contentBooleanfalseWhen true, the engine will also search by content, you may need to tweak the distance parameter as well. Please note that, it may become a performance killer on a large site.
index_all_pagesBooleantrueWhen true, all pages except noindex pages will be indexed, include non-regular pages, such as home and taxonomy lists.
expand_results_metaBooleanfalseWhen true, expand the results meta by default.
modal_containerStringbodyThe container for the search modal. It should be a valid CSS selector. Leave it empty if you’re using single search page mode only.
lazy_loadingBooleantrueLazy loading the indices.

params.toml

1[search]
2  min_match_char_length = 3

params.yaml

1search:
2  min_match_char_length: 3

params.json

1{
2   "search": {
3      "min_match_char_length": 3
4   }
5}

See Hugo Search Module for details.