Troubleshooting
This guide helps you diagnose and resolve common issues with the Smart Search Plugin.
Search icon not appearing
Symptoms
- Search icon missing from navigation bar
- Navigation bar appears normal otherwise
Possible causes
- Incorrect navbar configuration
- Plugin not properly installed
- Theme configuration issues
Solution
Check configuration file
// docusaurus.config.js
module.exports = {
themeConfig: {
navbar: {
items: [
{
type: 'search',
position: 'right',
},
],
},
},
};Verify installation
# Check package.json dependencies
npm ls smart-search-plugin
# Reinstall if necessary
npm install smart-search-pluginClear 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 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 file structure
docs/
├── intro.md
└── category/
└── document.mdRebuild 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.json file.
// Check index file size
ls -lh static/searchIndex.jsonOptimize the performance.
// docusaurus.config.js
module.exports = {
plugins: [
[
'smart-search-plugin',
{
maxResults: 8, // Limit results
minQueryLength: 3, // Minimum search length
},
],
],
};
Console errors
- "Cannot find module 'smart-search-plugin'"
# Solution
npm install smart-search-plugin --save - "Search index not found"
# Solution
npm run build
Reporting issues
When you encounter issues that aren't covered in the troubleshooting guide, here's how to get help.
Open a bug-report in the repo.
Provide a descriptive title, detailed description of the issue, and the following information:
**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.js
module.exports = {
// Your configuration
};Add any error logs.
# Build logs
npm run build -- --debug