# Search

Full-text search over every page and heading, built at compile time and shipped with the site.

Source: https://bugstars-docs.pages.dev/search/

---

<Alert variant="tip" title="Try it on this site" text="Press ⌘K, or Ctrl+K on Windows. Arrow keys move, Enter opens, Esc closes."/>

## How the index works

Search is [Pagefind](https://pagefind.app/), run by the Pagefind CLI against `dist/` after the build. Each page is split at its headings, so a result lands on the exact section rather than the top of a long page — the overlay lists the matched headings under the page they belong to.

The index is static files under `/pagefind/`, loaded on first keypress. No search service, no API key, no per-query cost.

<Alert variant="note" title="There is no index on the dev server" text="`npm run dev` doesn't build one, so the overlay shows its unavailable notice. Run `npm run search:dev` to generate an index you can search locally."/>

## What gets indexed

The docs shell marks the article column `data-pagefind-body`, so navigation, breadcrumbs and the feedback block stay out of results. Page title and description are weighted above body text.

To keep a page out of the index entirely, set `noindex: true` in frontmatter. That drops `data-pagefind-body` from the page and adds a `noindex` robots tag, so it is out of this search and out of search engines. To hide only part of a page, wrap it in an element with `data-pagefind-ignore`.

## Switching to a hosted provider

Past a few thousand pages a hosted index starts to pay for itself. The overlay, keyboard behavior and result grouping live in `src/components/navigation/search/`, and only the query backend in `setup.ts` would change.
