Add unified cross-product search to the landing page#56
Merged
Conversation
The landing page had no search and each product's TypeDoc search is siloed, so finding a symbol required already knowing which product it lives in. The build now merges every product's TypeDoc search index (window.searchData: base64, deflate-compressed JSON with a serialized lunr 2.3.9 index) into a combined docs/assets/search.js, prefixing row URLs with the product folder and tagging rows with a product-<folder> class that landing.css styles as a badge. The landing page reuses TypeDoc's stock search client (main.js, copied from the engine build) for the dialog, ranking, and keyboard shortcuts, replacing the hand-rolled inline theme/menu handlers it now drives. Engine results carry a 1.25x boost plus 2x on classes (mirroring its TypeDoc searchGroupBoosts); the legacy engine-v1 index is excluded via searchExclude in repos-config.json. Missing or format-drifted product indexes are skipped with a warning rather than failing the build. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds a unified, cross-product search experience to the landing page by reusing TypeDoc’s built-in client UI and generating a merged search index during the build.
Changes:
- Introduces a build-time
mergeSearchIndexes()step to decode each product’s TypeDocsearch.js, rewrite URLs/classes, and emit a single combineddocs/assets/search.js. - Updates the landing page to use TypeDoc’s stock search trigger/dialog and loads TypeDoc client assets (
main.js,icons.js, mergedsearch.js). - Adds per-repo search tuning (
searchExclude,searchBoost,searchKindBoosts) and styles per-product result badges.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
build.mjs |
Adds merged search index generation and copies TypeDoc client assets (main.js, icons.js) into shared landing assets. |
index.html |
Integrates TypeDoc search UI markup and scripts; removes the custom inline handlers now covered by main.js. |
assets/landing.css |
Styles product-<folder> classes as per-product badges in search results. |
repos-config.json |
Adds per-repo search config knobs and excludes engine-v1 from the combined index. |
README.md |
Documents how global search works, what’s merged, and the TypeDoc/lunr coupling. |
package.json |
Pins lunr devDependency to 2.3.9 to match TypeDoc’s client. |
package-lock.json |
Locks lunr@2.3.9 installation details. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a global search to the landing page that spans all products, so visitors no longer need to know which product a symbol lives in before they can search for it.
build.mjs: newmergeSearchIndexes()step (runs in both full and--landing-onlybuilds) decodes each product''s TypeDoc search index (window.searchData= base64, deflate-compressed JSON containing a serialized lunr 2.3.9 index), prefixes row URLs with the product folder, tags each row with aproduct-<folder>class, rebuilds a single combined index with TypeDoc-identical builder settings, and writes it todocs/assets/search.js.copySharedAssets()now also copies TypeDoc''smain.jsandicons.jsfrom the engine build.index.html: adds TypeDoc 0.28''s stock search trigger/dialog markup and script tags. The hand-rolled inline theme/menu handlers are removed sincemain.jsnow drives those elements (same markup contract the landing page already mirrors).assets/landing.css: styles theproduct-<folder>class as a badge (Engine, PCUI, ...) on each search result, themed via TypeDoc CSS variables.repos-config.json: new optional per-repo search fields — engine getssearchBoost: 1.25andsearchKindBoosts: {128: 2}(restores its TypeDocsearchGroupBoostsclass boost, which is baked into the original index and lost on re-merge);engine-v1is excluded viasearchExcludeto keep ~4,700 near-duplicate legacy symbols out (its own per-product search is untouched).package.json: addslunr@2.3.9, pinned to match the version bundled in TypeDoc''s client.Why reuse TypeDoc''s client instead of writing a custom search UI
The landing page already mirrors TypeDoc''s markup and reuses its stylesheet. Pointing TypeDoc''s own
main.jsat a combined index in the exact same format gets the dialog UX, ranking, Ctrl+K //shortcuts, keyboard navigation, a11y, and graceful failure with zero client-side JS to maintain.Notes for reviewers
asyncthe same way.docs/tree: round-trip decode/query in Node, plus browser checks (search/keyboard shortcuts/theme toggle/mobile menu, light+dark themes, result navigation to/engine/classes/AppBase.html, missing-index failure modes).🤖 Generated with Claude Code