mirror of
https://github.com/imfing/hextra.git
synced 2025-05-13 18:07:22 -04:00
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.
|
// Preload the search index.
|
||||||
async function preloadIndex() {
|
async function preloadIndex() {
|
||||||
|
const tokenize = '{{- site.Params.search.flexsearch.tokenize | default "forward" -}}';
|
||||||
window.pageIndex = new FlexSearch.Document({
|
window.pageIndex = new FlexSearch.Document({
|
||||||
tokenize: 'forward',
|
tokenize,
|
||||||
cache: 100,
|
cache: 100,
|
||||||
document: {
|
document: {
|
||||||
id: 'id',
|
id: 'id',
|
||||||
@ -183,7 +184,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
window.sectionIndex = new FlexSearch.Document({
|
window.sectionIndex = new FlexSearch.Document({
|
||||||
tokenize: 'forward',
|
tokenize,
|
||||||
cache: 100,
|
cache: 100,
|
||||||
document: {
|
document: {
|
||||||
id: 'id',
|
id: 'id',
|
||||||
|
@ -136,6 +136,9 @@ params:
|
|||||||
flexsearch:
|
flexsearch:
|
||||||
# index page by: content | summary | heading | title
|
# index page by: content | summary | heading | title
|
||||||
index: content
|
index: content
|
||||||
|
# full | forward | reverse | strict
|
||||||
|
# https://github.com/nextapps-de/flexsearch/#tokenizer-prefix-search
|
||||||
|
tokenize: forward
|
||||||
|
|
||||||
editURL:
|
editURL:
|
||||||
enable: true
|
enable: true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user