Skip to content

Commit

Permalink
fix: Cannot load unregistered function: stemmer-ru
Browse files Browse the repository at this point in the history
fixes #8830
  • Loading branch information
yufeih committed Oct 24, 2023
1 parent 34f4e5b commit 7eb8db7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 2 additions & 0 deletions samples/seed/template/public/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ export default {
title: 'Twitter'
}
],
lunrLanguages: ['en', 'ru'],
configureHljs: function (hljs) {
hljs.registerLanguage('bicep', bicep);
},
}

14 changes: 7 additions & 7 deletions templates/modern/src/search-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,6 @@ async function loadIndexCore() {
const data = await res.json() as { [key: string]: SearchHit }
const cache = createStore('docfx', 'lunr')

if (etag) {
const value = JSON.parse(await get('index', cache) || '{}')
if (value && value.etag === etag) {
return { index: lunr.Index.load(value), data }
}
}

const { lunrLanguages, configureLunr } = await import('./main.js').then(m => m.default) as DocfxOptions

if (lunrLanguages && lunrLanguages.length > 0) {
Expand All @@ -41,6 +34,13 @@ async function loadIndexCore() {
await Promise.all(lunrLanguages.map(initLanguage))
}

if (etag) {
const value = JSON.parse(await get('index', cache) || '{}')
if (value && value.etag === etag) {
return { index: lunr.Index.load(value), data }
}
}

const index = lunr(function() {
lunr.tokenizer.separator = /[\s\-.()]+/

Expand Down

0 comments on commit 7eb8db7

Please sign in to comment.