diff --git a/assets/js/flexsearch.js b/assets/js/flexsearch.js index 15e5a1d2..1c5eb35b 100644 --- a/assets/js/flexsearch.js +++ b/assets/js/flexsearch.js @@ -172,8 +172,9 @@ document.addEventListener("DOMContentLoaded", function () { // Preload the search index. async function preloadIndex() { + const tokenize = '{{- site.Params.search.flexsearch.tokenize | default "forward" -}}'; window.pageIndex = new FlexSearch.Document({ - tokenize: 'forward', + tokenize, cache: 100, document: { id: 'id', @@ -183,7 +184,7 @@ document.addEventListener("DOMContentLoaded", function () { }); window.sectionIndex = new FlexSearch.Document({ - tokenize: 'forward', + tokenize, cache: 100, document: { id: 'id', diff --git a/exampleSite/hugo.yaml b/exampleSite/hugo.yaml index 1def5550..0da0ad99 100644 --- a/exampleSite/hugo.yaml +++ b/exampleSite/hugo.yaml @@ -136,6 +136,9 @@ params: flexsearch: # index page by: content | summary | heading | title index: content + # full | forward | reverse | strict + # https://github.com/nextapps-de/flexsearch/#tokenizer-prefix-search + tokenize: forward editURL: enable: true