Custom Search
Rspress provides built-in full-text search functionality, but also allows you to customize the search experience or integrate third-party search services. This chapter covers search configuration, customization, and integration with external search providers.
Built-in Search
Enable Built-in Search
Rspress includes FlexSearch-based search by default:
Search Features
The built-in search provides:
- Full-text search - Search across all documentation content
- Instant results - Real-time search as you type
- Keyboard navigation - Navigate results with arrow keys
- Highlighting - Matched terms are highlighted in results
- Version filtering - Filter by documentation version
Search Keyboard Shortcuts
- Ctrl/Cmd + K - Open search
- Arrow keys - Navigate results
- Enter - Go to selected result
- Esc - Close search
Configure Built-in Search
Basic Configuration
Advanced Configuration
Custom Search UI
Override Search Component
Create a custom search component:
Custom Search Styles
Algolia DocSearch Integration
Why Algolia DocSearch?
Algolia DocSearch provides:
- Extremely fast search
- Better ranking algorithm
- Typo tolerance
- Analytics and insights
- Free for open-source projects
Setup Algolia DocSearch
- Apply for DocSearch
Visit docsearch.algolia.com and apply for free access.
- Get Your Credentials
After approval, you'll receive:
- Application ID
- API Key
- Index Name
- Configure in Rspress
Customize Algolia UI
Custom Search Provider
Integrate Third-Party Search
Create a custom search provider:
Use Custom Provider
Search Analytics
Track Search Queries
Monitor Popular Searches
Search Optimization
Improve Search Indexing
Add Search Metadata
Improve search results with frontmatter:
Troubleshooting
Search Not Working
Check configuration:
Poor Search Results
Improve indexing:
Algolia Not Loading
Check credentials and network:
Best Practices
1. Optimize Index Size
Keep search index manageable:
2. Use Descriptive Titles
Help users find content:
3. Add Search Keywords
Include common search terms:
4. Test Search Regularly
Monitor search quality:
Next Steps
- Learn about Built-in Components to enhance content
- Explore Build Extensions for advanced features
- Check out Custom Theme for styling search UI
::: tip 💡 Search Tips
- Use Algolia DocSearch for public documentation (it's free!)
- Implement search analytics to understand user needs
- Regularly test and optimize search results
- Add synonyms for common terms :::
::: info 📊 Search Performance
- Built-in search: Best for small to medium sites (<500 pages)
- Algolia: Best for large sites (500+ pages) or public docs
- Custom provider: Best for specific requirements or existing infrastructure :::
::: warning ⚠️ Privacy Considerations
- Search queries may be logged for analytics
- Consider privacy policies when using third-party search
- Allow users to opt-out of search tracking if needed :::