Built-in Search

Full-text search powered by a build-time index with fuzzy matching and keyboard navigation.

DocuBook Flame includes a built-in full-text search that works entirely client-side — no external services required. The search index is generated at build time and loaded on demand.

How It Works

  1. Build-time indexing — During bun build, all MDX files are scanned and a search-index.json is generated
  2. Hierarchy-based records — Each page produces multiple records: title (lvl1), headings (lvl2–lvl6), and content paragraphs
  3. Client-side search — The index is fetched on first modal open and cached in memory

Features

  • Fuzzy matching — Tolerates typos using Levenshtein distance
  • Weighted scoring — Title matches rank higher than heading matches, which rank higher than content matches
  • Grouped results — Results are grouped by section (lvl0) with appropriate icons per type
  • Keyboard navigation — Full keyboard support: ⌘K to open, ↑↓ to navigate, Enter to select, Esc to close

Keyboard Shortcuts

ShortcutAction
⌘ + K / Ctrl + KOpen search modal
Navigate results
EnterGo to selected result
EscClose modal

Search Scope

The indexer extracts the following from each MDX file:

  • lvl0 — Section name (from route configuration)
  • lvl1 — Page title (from frontmatter)
  • lvl2–lvl6 — Headings (h2 through h6)
  • content — First paragraph after each heading

Configuration

Search works out of the box with no configuration. The index is automatically regenerated on every build.

To manually regenerate the search index:

bash
bun .docu/node/search-indexer.ts

Last updated Jul 4, 2026