Installation
Install the plugin using your preferred package manager:Quick Start
Add the Orama search component to your Nextra site:pages/_app.js
The plugin automatically indexes your content at runtime and provides instant client-side search.
Configuration
Basic Configuration
Use the default configuration for quick setup:pages/_app.js
Advanced Configuration
Customize search behavior and relevance:pages/_app.js
Configuration Options
Maximum number of search results to display. Higher values show more results but may impact performance.
Configure relevance boosting for different content fields.
Component Features
TheOramaSearch component provides:
Match Highlighting
Automatically highlights search terms in results
Grouped Results
Results are grouped by page for better organization
Keyboard Navigation
Full keyboard support with ⌘K/Ctrl+K shortcuts
Real-Time Search
Instant results as you type with no lag
Responsive Design
Works perfectly on all device sizes
Theme Support
Automatically matches your Nextra theme
How It Works
The plugin operates in several stages:1. Content Indexing
When your app loads, the plugin:- Reads your Nextra page structure
- Extracts content from all documentation pages
- Creates an Orama search index
- Stores the index in memory for fast access
2. Search Execution
When users search:- Queries are executed against the in-memory index
- Results are highlighted using
@orama/plugin-match-highlight - Results are grouped by document/page
- Relevance is calculated using boost factors
3. Result Display
Results are displayed with:- Document title grouping
- Highlighted matching terms
- Content snippets
- Direct navigation links
Search Index Structure
The plugin creates an index with this schema:Search UI Components
The plugin includes several React components:OramaSearch
Main search component with input and results:Search Input
The search input includes:- Placeholder text: “Search documentation…”
- Keyboard shortcut indicator (⌘K)
- Focus/blur state management
- Auto-clear on navigation
Search Results
Results display with:- Grouped by page title
- Highlighted matched terms
- Content snippets
- Click-to-navigate functionality
Orama Footer
Branded footer showing:- Number of results found
- “Powered by Orama” badge
- Search performance metrics
Highlighting
The plugin uses@orama/plugin-match-highlight for intelligent highlighting:
- Exact Matches: Highlights exact term matches
- Partial Matches: Highlights partial word matches
- Context Preservation: Shows surrounding context
- Multiple Terms: Highlights all query terms
Multi-Language Support
For multi-language Nextra sites:pages/_app.js
- Detects the current locale from Next.js router
- Indexes content for each locale separately
- Maintains separate search indexes per language
Keyboard Shortcuts
The search component supports these keyboard shortcuts:Opens or focuses the search input
Closes the search results or clears the input
Navigate through search results
Navigate to the selected result
Styling
The plugin uses Nextra’s default styling with additional custom classes:Custom Styling
Override styles with CSS:styles.css
Performance Optimization
The plugin is optimized for performance:Index Creation
- Indexes are created asynchronously on app load
- Content is indexed in parallel when possible
- Memory-efficient data structures
Search Execution
- Debounced search input (waits for user to stop typing)
- Efficient full-text search algorithms
- Result limit prevents overwhelming the UI
Result Rendering
- Virtual scrolling for large result sets
- Lazy loading of result details
- Efficient React rendering with keys
Advanced Usage
Custom Result Grouping
The plugin groups results by title. You can customize grouping logic:Manual Index Creation
For advanced use cases, create indexes manually:Troubleshooting
Search not appearing
Search not appearing
Ensure the
OramaSearch component is included in your _app.js file and is rendered in the component tree.No results found
No results found
Check that:
- Your Nextra pages have content to index
- The router is ready (
router.isReadyreturns true) - Content is in the expected locale
Keyboard shortcuts not working
Keyboard shortcuts not working
Ensure no other components or libraries are capturing the ⌘K/Ctrl+K shortcut. The plugin uses
useFocus hook to manage keyboard events.Highlighting not working
Highlighting not working
Verify that If missing, reinstall the Nextra plugin:
@orama/plugin-match-highlight is installed:Package Information
- Package Name:
@orama/plugin-nextra - Version: 3.1.18
- License: Apache-2.0
- Repository: github.com/oramasearch/orama
Dependencies
The plugin includes:@orama/orama: Core search engine@orama/plugin-match-highlight: Search result highlightingnext: Next.js frameworkreact&react-dom: React librariesclassnames: CSS class utilities
Requirements
- Nextra 2.x or 3.x
- Next.js ^14.0.0
- React ^18.0.0
- Node.js >= 16
Next Steps
Match Highlight Plugin
Learn about the highlighting system
Core Database
Explore the core search engine
Search Guide
Learn about search features
Full Documentation
View the complete guide