Skip to content

Comments

feat: Add Pagefind full-text search to CMD K#404

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/add-pagefind-cmd-k-search
Draft

feat: Add Pagefind full-text search to CMD K#404
Copilot wants to merge 3 commits intomainfrom
copilot/add-pagefind-cmd-k-search

Conversation

Copy link
Contributor

Copilot AI commented Feb 13, 2026

Integrates Pagefind for full-text documentation search in the existing CMD K interface, replacing basic keyword matching with relevance-ranked results and highlighted excerpts.

Implementation

Build-time indexing:

  • scripts/generate-search-html.ts extracts markdown content from app/docs/ to static HTML
  • Pagefind CLI indexes HTML post-build: npx pagefind --site .next/search-html --output-path public/pagefind
  • 8 pages, 728 words indexed → ~330KB static search bundle

Runtime search:

// CmdK.tsx - new hook for Pagefind integration
function usePagefindSearch(query: string, enabled: boolean) {
  useEffect(() => {
    const pagefind = await import(/* webpackIgnore: true */ "/pagefind/pagefind.js");
    const results = await pagefind.debouncedSearch(query, { debounce: 150 });
    // Process and display results with excerpts
  }, [query, enabled]);
}

Fallback strategy:

  • Query < 2 chars → show all docs (original behavior)
  • Pagefind unavailable → keyword matching (original behavior)
  • Resource queries (0x...) → unchanged prefix trie search

CSP updates:

// next.config.ts - added for Pagefind WASM workers
script-src 'self' 'unsafe-eval' 'unsafe-inline' blob:;
worker-src 'self' blob:;

Screenshots

Full-text search with highlighted excerpts:

Search "metadata"

Search "CAIP-10"

Notes

  • website/public/ symlinks to ../xmatter/, so pagefind index written to xmatter/pagefind/ (added to .gitignore)
  • Used npx -y pagefind instead of direct dependency due to bun install network issues during implementation
  • Existing address search, theme switcher, and keyboard shortcuts unchanged

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • fonts.googleapis.com
    • Triggering command: /tmp/bun-node-b64edcb49/node node /home/REDACTED/work/xmatter/xmatter/website/node_modules/.bin/next build (dns block)
    • Triggering command: /home/REDACTED/.bun/bin/bun /home/REDACTED/.bun/bin/bun /home/REDACTED/work/xmatter/xmatter/node_modules/.bun/next@16.1.6&#43;bf16f8eded5e12ee/node_modules/next/dist/server/lib/start-server.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Add pagefind to CMD K Search</issue_title>
<issue_description></issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@vercel
Copy link

vercel bot commented Feb 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
xmatter Error Error Feb 13, 2026 3:54pm

Copilot AI and others added 2 commits February 13, 2026 15:45
Co-authored-by: fuxingloh <4266087+fuxingloh@users.noreply.github.com>
Co-authored-by: fuxingloh <4266087+fuxingloh@users.noreply.github.com>
Copilot AI changed the title [WIP] Add pagefind to CMD K search feature Add Pagefind full-text search to CMD K Feb 13, 2026
Copilot AI requested a review from fuxingloh February 13, 2026 15:53
@fuxingloh fuxingloh closed this Feb 14, 2026
@fuxingloh fuxingloh reopened this Feb 14, 2026
@fuxingloh fuxingloh changed the title Add Pagefind full-text search to CMD K feat: Add Pagefind full-text search to CMD K Feb 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add pagefind to CMD K Search

2 participants