Search Functionality
This page explains how to set up and use Algolia DocSearch for your FluxGen documentation.
What is Algolia DocSearch?
Algolia DocSearch is a powerful, fast search solution specifically designed for documentation sites. It provides:
- Instant search results as you type
- Keyboard navigation
- Contextual results with highlighting
- Mobile-friendly search interface
- Free for open-source projects
Current Status
The Algolia search is now ACTIVE and working! 🎉
You should see a search bar in the top navigation. Try it out:
- Click the search icon in the navbar
- Or press
Ctrl+K(Windows/Linux) orCmd+K(Mac) - Start typing to see instant results!
How It Works
Algolia crawls your documentation and creates a searchable index. The search is configured with:
- App ID: 4ME8QJ18ZN
- Index Name: FLUXGEN_DOCS
- Contextual Search: Enabled
How to Set Up Search (For Reference)
Step 1: Apply for DocSearch
Visit https://docsearch.algolia.com/apply/ and submit your documentation site.
Requirements:
- Your documentation must be publicly available
- You must be the owner of the documentation
- The website should have good content
Step 2: Get Your Credentials
Once approved, Algolia will send you:
appId: Your application IDapiKey: Your search-only API keyindexName: Your index name
Step 3: Update Configuration
Open docusaurus.config.ts and uncomment the Algolia configuration:
themeConfig: {
// ... other config
algolia: {
appId: 'YOUR_APP_ID', // Replace with your appId
apiKey: 'YOUR_SEARCH_API_KEY', // Replace with your apiKey
indexName: 'YOUR_INDEX_NAME', // Replace with your indexName
contextualSearch: true,
searchParameters: {},
searchPagePath: 'search',
},
// ... other config
}
Step 4: Test the Search
After configuring:
- Rebuild your site:
npm run build - The search bar will appear in the navbar
- Press
Ctrl+KorCmd+Kto open search - Start typing to see results
Search Features
Keyboard Shortcuts
| Shortcut | Action |
|---|---|
Ctrl/Cmd + K | Open search |
↑ / ↓ | Navigate results |
Enter | Go to selected result |
Esc | Close search |
Search Operators
Algolia supports advanced search:
- Phrase search: Use quotes
"exact phrase" - AND operator:
water AND quality - OR operator:
sensor OR device - NOT operator:
api -deprecated
Contextual Results
Search results show:
- Page title
- Section heading
- Highlighted matching text
- Breadcrumb navigation
Search Customization
You can customize search behavior:
algolia: {
// ... credentials
searchParameters: {
facetFilters: ['language:en', 'version:1.0'],
hitsPerPage: 10,
},
contextualSearch: true, // Separate results by docs version
searchPagePath: 'search', // Path for the search page
},
Alternative: Local Search
If you prefer not to use Algolia, you can use local search plugins:
Option 1: docusaurus-search-local
npm install @easyops-cn/docusaurus-search-local
Add to docusaurus.config.ts:
themes: [
[
require.resolve("@easyops-cn/docusaurus-search-local"),
{
hashed: true,
language: ["en"],
highlightSearchTermsOnTargetPage: true,
explicitSearchResultPath: true,
},
],
],
Option 2: docusaurus-lunr-search
npm install docusaurus-lunr-search
Add to docusaurus.config.ts:
plugins: [
require.resolve('docusaurus-lunr-search'),
],
Search Best Practices
1. Optimize Content for Search
- Use descriptive headings
- Include relevant keywords naturally
- Add summaries at the top of pages
- Use consistent terminology
2. Structure Your Docs
---
title: Water Quality Monitoring
description: Learn how to monitor water quality using pH, temperature, and turbidity sensors
keywords: [water, quality, pH, sensors, monitoring]
---
3. Avoid Common Issues
- Don't use generic titles like "Overview"
- Avoid duplicate content across pages
- Keep URLs meaningful and stable
- Use proper heading hierarchy
Testing Your Search
Manual Testing
- Search for common terms
- Try misspellings
- Test phrase searches
- Verify keyboard navigation
- Check mobile experience
Analytics
Algolia provides search analytics:
- Most searched terms
- No-results queries
- Click-through rates
- Popular pages
Access analytics at: https://www.algolia.com/apps/YOUR_APP_ID/analytics/
Troubleshooting
Search Not Appearing
- Check if credentials are correct
- Verify the index exists in Algolia
- Clear cache:
npm run clear - Rebuild:
npm run build
No Results Found
- Wait for Algolia to crawl your site (can take 24h)
- Check if your site is publicly accessible
- Verify the crawler configuration
Outdated Results
Algolia crawls your site regularly, but you can:
- Trigger manual reindexing
- Update the crawler schedule
- Use the Algolia API to update specific pages
Example Search Queries for FluxGen
Try these searches once enabled:
- "sensor configuration"
- "API authentication"
- "storm processing"
- "water quality alerts"
- "deployment guide"
- "batch processing"
Next Steps
- Apply for DocSearch: Visit the application page
- Wait for approval: Usually takes a few days
- Configure credentials: Update
docusaurus.config.ts - Test thoroughly: Ensure search works as expected
- Monitor analytics: Track what users search for
Resources
Note: This documentation site currently has Algolia configured but commented out. Follow the steps above to enable it for your FluxGen documentation!