Files
Claude-Code-Workflow/docs/.vitepress/search/flexsearch.mjs
catlog22 c3ddf7e322 docs: add VitePress documentation site
- Add docs directory with VitePress configuration
- Add GitHub Actions workflow for docs build and deploy
- Support bilingual (English/Chinese) documentation
- Include search, custom theme, and responsive design
2026-02-28 16:14:09 +08:00

26 lines
529 B
JavaScript

export const FLEXSEARCH_INDEX_VERSION = 1
export function flexsearchEncode(text) {
const normalized = String(text ?? '')
.toLowerCase()
.normalize('NFKC')
const tokens = normalized.match(
/[a-z0-9]+|[\u3040-\u30ff\u3400-\u4dbf\u4e00-\u9fff\uac00-\ud7af]/g
)
return tokens ?? []
}
export const FLEXSEARCH_OPTIONS = {
tokenize: 'forward',
resolution: 9,
cache: 100,
encode: flexsearchEncode
}
export function createFlexSearchIndex(FlexSearch) {
return new FlexSearch.Index(FLEXSEARCH_OPTIONS)
}