Closed ApsarasX closed 2 months ago
Maybe you should update your config in docusaurus.config.js
, move the config in plugins to themes.
Please read the README, thx~
// In your docusaurus.config.js
:
module.exports = {
// ... Your other configurations.
themes: [
// ... Your other themes.
[
require.resolve("@easyops-cn/docusaurus-search-local"),
{
// ... Your options.
// `hashed` is recommended as long-term-cache of index file is possible.
hashed: true,
// For Docs using Chinese, The `language` is recommended to set to:
// ```
// language: ["en", "zh"],
// ```
},
],
],
};
Maybe you should update your config in
docusaurus.config.js
, move the config in plugins to themes. Please read the README, thx~// In your
docusaurus.config.js
:module.exports = { // ... Your other configurations. themes: [ // ... Your other themes. [ require.resolve("@easyops-cn/docusaurus-search-local"), { // ... Your options. // `hashed` is recommended as long-term-cache of index file is possible. hashed: true, // For Docs using Chinese, The `language` is recommended to set to: // ``` // language: ["en", "zh"], // ``` }, ], ], };
@brightzoe
The config of docusaurus-search-local
is in the theme
is indeed.😂
This is the docusaurus.config.js
of my blog.
You can safely dismiss this warning.
The fix has been discussed in:
Seems this is fixed by:
Have you tried lifting the call to
lunr.multiLanguage
out of the regeneration function in order to call it once, and passing its return value tothis.use
?
Code example from that comment:
"use strict";
const lunr = require("lunr");
require("lunr-languages/lunr.stemmer.support")(lunr);
require("lunr-languages/lunr.multi")(lunr);
require("lunr-languages/lunr.it")(lunr);
let englishItalianSupport = lunr.multiLanguage('en', 'it'); // here
// > Access to the index for full text search
let fullTextIndex;
// > Generate the index for full text search
exports.regenerateFullTextIndex = function(documents) {
fullTextIndex = lunr(function() {
this.use(englishItalianSupport); // ...and here
this.ref("id");
this.field("title");
this.field("body");
const len = documents.length;
for(let i = 0; i < len; ++i) {
this.add({id: documents[i].id, title: documents[i].title, body: documents[i].text});
}
});
};
@weareoutman: Is above info enough for you to get rid of these warnings when building?
My Config is as shown below.