Skip to content

fix(search): add search in dev and add baseUrl so search works again#57

Open
janelletam wants to merge 5 commits into
masterfrom
janelle/fix/docs-126-docs-fix-search
Open

fix(search): add search in dev and add baseUrl so search works again#57
janelletam wants to merge 5 commits into
masterfrom
janelle/fix/docs-126-docs-fix-search

Conversation

@janelletam

@janelletam janelletam commented Jun 16, 2026

Copy link
Copy Markdown
Contributor
  • Add search in dev

  • Add baseUrl so search works again

    image image
  • Reorder sidebar section so adk is right after Getting Started section to match mintlify docs

@linear-code

linear-code Bot commented Jun 16, 2026

Copy link
Copy Markdown

DOCS-126

@janelletam janelletam marked this pull request as ready for review June 16, 2026 21:22
@greptile-apps

greptile-apps Bot commented Jun 16, 2026

Copy link
Copy Markdown

Greptile Summary

This PR fixes search by removing the PROD-only guard, threading baseUrl into the pagefind path, and adding a pagefind:dev script plus Tilt resource so developers can generate a local search index without a full production build. It also refactors the search UI to surface pagefind sub_results (page sections), adds query-term highlighting and breadcrumbs, swaps inline SVGs for lucide-react icons, and reorders the ADK sidebar entry to follow "Getting Started".

  • Dev-mode search: pagefind:dev builds the site and writes the pagefind index to public/pagefind/, which the Astro dev server serves at /docs/pagefind/; search-overlay.tsx now loads from ${origin}${baseUrl}/pagefind/pagefind.js instead of always ${origin}/pagefind/pagefind.js, fixing production deployments under a subpath.
  • Search UX improvements: Results are now sourced from sub_results (up to 3 per page, max 10 total), matching terms are highlighted via a regex-split highlight function, keyboard navigation auto-scrolls to the selected item, and a keyboard-hint footer is added.
  • Sidebar reorder: ADK group is moved immediately after "Getting Started" in bach.config.ts, aligning with the existing Mintlify docs structure.

Confidence Score: 5/5

Safe to merge — all changes are additive dev tooling improvements and a straightforward bug fix with no regressions on the critical path.

The search path fix and dev script are well-scoped. The public/pagefind/ directory is correctly gitignored, the Tilt resource correctly uses cmd for the one-shot index build, and the UI refactor in search-overlay.tsx uses established patterns without introducing new state-management complexity.

No files require special attention.

Important Files Changed

Filename Overview
src/components/search-overlay.tsx Removes PROD-only guard, adds baseUrl to pagefind path, refactors results into sub-result entries with breadcrumbs, query highlighting, and scrollable keyboard navigation
package.json Adds pagefind:dev script that builds the Astro site and generates a pagefind index into public/pagefind/ for use by the dev server
Tiltfile Adds a one-shot create index resource using cmd (not serve_cmd) to run pagefind:dev in Tilt, correctly treating it as a build step
bach.config.ts Moves ADK sidebar group from near-bottom to immediately after Getting Started, matching Mintlify docs ordering
.gitignore Adds public/pagefind/ to gitignore to exclude the generated dev search index from version control

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant Dev as Developer
    participant Script as pagefind:dev script
    participant Astro as Astro Build
    participant PF as Pagefind CLI
    participant Public as public/pagefind/
    participant DevSrv as Astro Dev Server
    participant Browser as Browser (Search UI)

    Dev->>Script: bun pagefind:dev
    Script->>Astro: astro build
    Astro-->>Script: build complete
    Script->>PF: pagefind --site dist/docs --output-path public/pagefind
    PF-->>Public: writes pagefind.js + index files
    Public-->>Script: done

    Dev->>DevSrv: bun dev
    DevSrv-->>Browser: serves /docs/ + /docs/pagefind/ (from public/)

    Browser->>DevSrv: dynamic import /docs/pagefind/pagefind.js
    DevSrv-->>Browser: pagefind runtime
    Browser->>DevSrv: pagefind.search(query)
    DevSrv-->>Browser: sub_results[] with URLs + anchors
    Browser->>Browser: flatten to SearchEntry[], highlight terms, show results
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant Dev as Developer
    participant Script as pagefind:dev script
    participant Astro as Astro Build
    participant PF as Pagefind CLI
    participant Public as public/pagefind/
    participant DevSrv as Astro Dev Server
    participant Browser as Browser (Search UI)

    Dev->>Script: bun pagefind:dev
    Script->>Astro: astro build
    Astro-->>Script: build complete
    Script->>PF: pagefind --site dist/docs --output-path public/pagefind
    PF-->>Public: writes pagefind.js + index files
    Public-->>Script: done

    Dev->>DevSrv: bun dev
    DevSrv-->>Browser: serves /docs/ + /docs/pagefind/ (from public/)

    Browser->>DevSrv: dynamic import /docs/pagefind/pagefind.js
    DevSrv-->>Browser: pagefind runtime
    Browser->>DevSrv: pagefind.search(query)
    DevSrv-->>Browser: sub_results[] with URLs + anchors
    Browser->>Browser: flatten to SearchEntry[], highlight terms, show results
Loading

Reviews (2): Last reviewed commit: "refactor(search): use lucide icons" | Re-trigger Greptile

Comment thread Tiltfile
@janelletam

Copy link
Copy Markdown
Contributor Author

@greptileai again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant