Skip to content

Commit

Permalink
Fix japanese search (dotnet#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 <yufeih@live.com>
  • Loading branch information
2 people authored and p-kostov committed Jun 28, 2024
1 parent 0ba1bd1 commit f8ab11a
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 f8ab11a

Please sign in to comment.