feat: support customize flexsearch tokenize option (#319)

Co-authored-by: loenvom <loenvom@qq.com>
This commit is contained in:
loenvom
2024-03-18 02:50:22 +08:00
committed by GitHub
parent 22d4737b99
commit c634cb83eb
2 changed files with 6 additions and 2 deletions

View File

@ -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',