An offline/local search plugin/theme for Docusaurus v2/v3, which supports multiple languages, especially optimized for language of zh.
Originally forked from cmfcmf/docusaurus-search-local.
Then later fully rewritten with TypeScript 💪, styles polished 💅, language of Chinese supported 🇨🇳, and tests covered ✅.
https://easyops-cn.github.io/docusaurus-search-local/


This plugin now supports Ask AI integration! Enable AI-powered assistance directly in your documentation site to help users get instant, context-aware answers.
NOTE: Ask AI feature requires an external AI service. Please refer to the Open Ask AI Server, which is a serverless solution, and can be used for free using Vercel Hobby Plan!
The Ask AI feature is opt-in. To enable it, you need to install the open-ask-ai package separately:
npm install --save open-ask-ai
# or
yarn add open-ask-ai


With Ask AI enabled, users can:
See the askAi option in Theme Options below for configuration details.
npm install --save @easyops-cn/docusaurus-search-local
# or
yarn add @easyops-cn/docusaurus-search-local
Add @easyops-cn/docusaurus-search-local into your docusaurus themes.
// In your `docusaurus.config.js`:
module.exports = {
// ... Your other configurations.
themes: [
// ... Your other themes.
[
require.resolve("@easyops-cn/docusaurus-search-local"),
/** @type {import("@easyops-cn/docusaurus-search-local").PluginOptions} */
({
// ... Your options.
// `hashed` is recommended as long-term-cache of index file is possible.
hashed: true,
// For Docs using Chinese, it is recomended to set:
// language: ["en", "zh"],
// Customize the keyboard shortcut to focus search bar (default is "mod+k"):
// searchBarShortcutKeymap: "s", // Use 'S' key
// searchBarShortcutKeymap: "ctrl+shift+f", // Use Ctrl+Shift+F
// If you're using `noIndex: true`, set `forceIgnoreNoIndex` to enable local index:
// forceIgnoreNoIndex: true,
// Enable Ask AI integration:
// askAi: {
// project: "your-project-name",
// apiUrl: "https://your-api-url.com/api/stream",
// hotkey: "cmd+I", // Optional: keyboard shortcut to trigger Ask AI
// },
}),
],
],
};
Notice: We present this as a theme instead of plugin now, see this comment.
| Name | Type | Default | Description |
|---|---|---|---|
| indexDocs | boolean | true |
Whether to index docs. |
| indexBlog | boolean | true |
Whether to index blog. |
| indexPages | boolean | false |
Whether to index pages. |
| docsRouteBasePath | string | string[] | "/docs" |
Base route path(s) of docs. Slash at beginning is not required. Note: for docs-only mode, this needs to be the same as routeBasePath in your @docusaurus/preset-classic config e.g., "/". |
| blogRouteBasePath | string | string[] | "/blog" |
Base route path(s) of blog. Slash at beginning is not required. |
| language | string | string[] | "en" |
All lunr-languages supported languages, + zh 🔥. |
| hashed | boolean | "filename" | "query" |
false |
Whether to add a hashed query when fetching index (based on the content hash of all indexed *.md in docsDir and blogDir if applicable). Setting to "filename" will save hash in filename instead of query. |
| docsDir | string | string[] | "docs" |
The dir(s) of docs to get the content hash, it's relative to the dir of your project. |
| blogDir | string | string[] | "blog" |
Just like the docsDir but applied to blog. |
| removeDefaultStopWordFilter | boolean | string[] | [] |
Sometimes people (E.g., us) want to keep the English stop words as indexed, since they maybe are relevant in programming docs. Set a language list to remove their default stop word filter, true is equivalent to ["en"]. |
| removeDefaultStemmer | boolean | false |
Enable this if you want to be able to search for any partial word at the cost of search performance. |
| highlightSearchTermsOnTargetPage | boolean | false |
Highlight search terms on target page. |
| searchResultLimits | number | 8 |
Limit the search results. |
| searchResultContextMaxLength | number | 50 |
Set the max length of characters of each search result to show. |
| explicitSearchResultPath | boolean | false |
Whether an explicit path to a heading should be presented on a suggestion template. |
| ignoreFiles | string | RegExp | (string | RegExp)[] | [] |
Set the match rules to ignore some routes. Put a string if you want an exact match, or put a regex if you want a partial match. Note: without the website base url. |
| ignoreCssSelectors | string | string[] | [] |
A list of css selectors to ignore when indexing each page. |
| searchBarShortcut | boolean | true |
Whether to enable keyboard shortcut to focus in search bar. |
| searchBarShortcutHint | boolean | true |
Whether to show keyboard shortcut hint in search bar. Disable it |
$ claude mcp add docusaurus-search-local \
-- python -m otcore.mcp_server <graph>