logo hsb.horse

Architecture Decision Record

Pagefind site search adoption policy

Adopt Pagefind for static full-text search and standardize localized search routes with build integration.

Accepted #search #pagefind #architecture #i18n

Pagefind site search adoption policy

Decision

  • Adopt Pagefind as the site-wide search engine.
  • Provide search routes at /search and /{lang}/search, using language-specific indexes based on html[lang].
  • Make Pagefind indexing mandatory after astro build in the build pipeline.
  • Route header search navigation to the current locale search page.

Context

The site is fully static and needs full-text search without introducing server-side search infrastructure. The site already serves multilingual URLs (ja/en/ko/fr/de/pt), so search behavior should stay language-scoped.

Options

  • Option A: Use an external hosted search service.
  • Option B: Build and maintain a custom search API.
  • Option C: Introduce Pagefind with static indexing (chosen).

Rationale

  • Pagefind runs after static HTML generation and fits the Astro workflow.
  • Language-aware index selection via html[lang] is available out of the box.
  • Client-side search keeps operational overhead low and avoids extra infrastructure dependencies.

Consequences

  • Production builds must generate dist/pagefind/.
  • Initial UI implementation uses @pagefind/default-ui, with room to move to a custom UI later.
  • Further relevance tuning (exclude selectors, weighting, metadata enrichment) will be added after observing real search usage.