forked from drowl87/hextra_mirror
feat: support customize flexsearch tokenize option (#319)
Co-authored-by: loenvom <loenvom@qq.com>
This commit is contained in:
parent
22d4737b99
commit
c634cb83eb
@ -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',
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user