Skip to main content

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) or Cmd+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 ID
  • apiKey: Your search-only API key
  • indexName: 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
}

After configuring:

  1. Rebuild your site: npm run build
  2. The search bar will appear in the navbar
  3. Press Ctrl+K or Cmd+K to open search
  4. Start typing to see results

Search Features​

Keyboard Shortcuts​

ShortcutAction
Ctrl/Cmd + KOpen search
↑ / ↓Navigate results
EnterGo to selected result
EscClose 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
},

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,
},
],
],
npm install docusaurus-lunr-search

Add to docusaurus.config.ts:

plugins: [
require.resolve('docusaurus-lunr-search'),
],

Search Best Practices​

  • 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

Manual Testing​

  1. Search for common terms
  2. Try misspellings
  3. Test phrase searches
  4. Verify keyboard navigation
  5. 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​

  1. Check if credentials are correct
  2. Verify the index exists in Algolia
  3. Clear cache: npm run clear
  4. Rebuild: npm run build

No Results Found​

  1. Wait for Algolia to crawl your site (can take 24h)
  2. Check if your site is publicly accessible
  3. Verify the crawler configuration

Outdated Results​

Algolia crawls your site regularly, but you can:

  1. Trigger manual reindexing
  2. Update the crawler schedule
  3. 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​

  1. Apply for DocSearch: Visit the application page
  2. Wait for approval: Usually takes a few days
  3. Configure credentials: Update docusaurus.config.ts
  4. Test thoroughly: Ensure search works as expected
  5. 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!