Skip to content

Commit

Permalink
Fix japanese search (#9605)
Browse files Browse the repository at this point in the history
* Fix japanease tinyseg deps

* Refactor import target suffix

* lint

---------

Co-authored-by: Yufei Huang <[email protected]>
  • Loading branch information
Egliss and yufeih authored Jan 11, 2024
1 parent 9dfa000 commit 8851faa
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions templates/modern/src/search-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import lunr from 'lunr'
import stemmer from 'lunr-languages/lunr.stemmer.support'
import tinyseg from 'lunr-languages/tinyseg'
import multi from 'lunr-languages/lunr.multi'
import { get, set, createStore } from 'idb-keyval'

Expand All @@ -28,6 +29,9 @@ async function loadIndex({ lunrLanguages }: { lunrLanguages?: string[] }) {
if (lunrLanguages && lunrLanguages.length > 0) {
multi(lunr)
stemmer(lunr)
if (lunrLanguages.includes('ja')) {
tinyseg(lunr)
}
await Promise.all(lunrLanguages.map(initLanguage))
}

Expand Down

0 comments on commit 8851faa

Please sign in to comment.