Troubleshooting the Plugin
Use this reference to identify symptoms, causes, and solutions for common Smart Search Plugin issues.
Search icon not appearing
Symptoms
- Search icon missing from the navigation bar
- Navigation bar appears normal otherwise
Possible causes
- Incorrect navbar configuration
- Plugin not properly installed
- Theme configuration issues
Solution
-
Check your configuration file.
docusaurus.config.jsmodule.exports = { themeConfig: { navbar: { items: [ { type: 'search', position: 'right', }, ], }, }, }; -
Verify the installation.
# Check package.json dependencies npm ls smart-search-plugin # Reinstall if necessary npm install smart-search-plugin -
Clear the cache and rebuild your project.
npm run clear npm run build
Search results not appearing
Symptoms
- Search bar works but shows no results
- No error messages in the console
Possible causes
- Missing document metadata
- Incorrect file structure
- Search index not generated
Solution
-
Verify document metadata.
--- title: Document Title description: Description text keywords: [keyword1, keyword2] --- -
Check the file structure.
docs/ ├── intro.md └── category/ └── document.md -
Rebuild the search index.
# Remove existing index rm -rf static/searchIndex.json # Rebuild project npm run build
Search performance issues
Symptoms
- Slow search response
- Browser performance degradation
- High memory usage
Solution
-
Optimize your metadata.
- Reduce the number of keywords.
- Keep descriptions concise.
- Remove unused metadata.
-
Check the size of the
searchIndex.jsonfile.ls -lh static/searchIndex.json -
Set result limits and minimum query length in your configuration.
docusaurus.config.jsmodule.exports = { plugins: [ [ 'smart-search-plugin', { maxResults: 8, // Limit results minQueryLength: 3, // Minimum search length }, ], ], };
Console errors
"Cannot find module 'smart-search-plugin'"
npm install smart-search-plugin --save"Search index not found"
npm run buildReporting issues
If an issue is not covered in this reference, open a bug report on GitHub.
-
Open a bug report in the repository.
-
Provide a descriptive title, a detailed description, and the following environment details.
**Environment** - Plugin Version: [version] - Docusaurus Version: [version] - Node Version: [version] - OS: [operating system] **Steps to reproduce** 1. [First Step] 2. [Second Step] 3. [Additional Steps...] **Expected behavior** [What you expected to happen] **Actual behavior** [What actually happened] **Additional context** [Any other relevant information] -
Include your Docusaurus configuration.
docusaurus.config.jsmodule.exports = { // Your configuration }; -
Add any relevant error logs.
# Build logs npm run build -- --debug