Conversation
Replaces the crawler-managed index with records built by dev/algolia-index.mjs from the contentlayer output, keyed by product from src/data/navigation.ts. Adds product filter chips and Page › Heading breadcrumbs to the search modal and a workflow that reindexes on push to main. Amp-Thread-ID: https://ampcode.com/threads/T-01a0b0ef-f7ad-7413-9f23-e047e8da9b10 Co-authored-by: Amp <amp@ampcode.com>
Drops the product optionalFilters boosts, which sat ahead of typo/attribute/ exact in Algolia's ranking and pushed Agentic Batch Changes and Deep Search hits above exact matches (batch changes, saml, SSO, getting started). Removes hierarchy.lvl0 (product) from searchable attributes so a product name in the query no longer matches every record in that product; adds English stop words and plurals so question-style queries work; imports synonyms (API key/access token, SSO/SAML/single sign-on, ...) into the temp index before the atomic move; dedupes repeated boilerplate content blocks by normalized hash; strips frontmatter; sets distinct to 2. Amp-Thread-ID: https://ampcode.com/threads/T-01a0b0ef-f7ad-7413-9f23-e047e8da9b10 Co-authored-by: Amp <amp@ampcode.com>
One scrollable product chip row with an overflow affordance; page/heading/ content icons per hit; match highlighting in breadcrumbs; one-line windowed snippets and none on page or heading hits; page and heading hits sorted before content hits with duplicate snippets removed per group; curated empty-state suggestions; linked products on the no-results screen; route prefetch for the highlighted hit; Ctrl/Cmd+Enter opens in a new tab; previous results stay visible while loading; platform-aware shortcut hint; the query is mirrored to ?search= so a search can be shared; full-height modal at 390px. Also clears the React 19 hooks lint warnings in the vendored DocSearch files. Amp-Thread-ID: https://ampcode.com/threads/T-01a0b0ef-f7ad-7413-9f23-e047e8da9b10 Co-authored-by: Amp <amp@ampcode.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Contributor
|
Swaps the old Algolia application ID for the new one in the allow list, exempts Algolia's minWordSizefor* setting names inline, and rewords a comment and a local variable. Amp-Thread-ID: https://ampcode.com/threads/T-01a0b0ef-f7ad-7413-9f23-e047e8da9b10 Co-authored-by: Amp <amp@ampcode.com>
marcleblanc2
approved these changes
Sep 17, 2026
marcleblanc2
left a comment
Contributor
There was a problem hiding this comment.
I love it. Preview deployment works great!
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.
Why
Docs search was not finding the page people wanted. Querying
batch changesreturns five Batch Changes sub-pages but not the Batch Changes page itself;code insightslikewise lists Quickstart, repository scope, and troubleshooting pages without the Code Insights landing page.API keyandSRC_ACCESS_TOKENreturn the same-dump-requests … -get-curlCLI flag table five times from differentsrcsubcommands, because the docs say "access token" and the crawler indexes the boilerplate under every command page.SSOreturns one page (Troubleshooting user authentication) five times, including its "On this page" heading, while the SAML setup guides are nowhere near the top. A question likehow do I configure SSOgets five hits, none about SSO. And every hit is grouped under Platform, Documentation, CLI & API, or Code Management, which says nothing about which product it belongs to, with multi-line snippets that leave about four results on screen.Two causes. The index was built by Algolia's crawler on the DocSearch tier: we could adjust settings in the Algolia dashboard, but every change was a manual UI edit outside the repo, and the record shape itself (what counts as a page, which product a hit belongs to, what content gets indexed) was whatever the crawler extracted from the rendered HTML. And the modal presented that hierarchy as-is, grouped by the crawler's
lvl0buckets with full multi-line snippets for every hit.What we did
Moved to a new Algolia application (
JSZOJ0ZYVG). The old app was on the free DocSearch tier, where the only way to get records into the index is Algolia's built-in crawler. The new one is a regular Algolia application, still on Algolia's free tier, so we can build and push the index ourselves from GitHub Actions on every merge tomain: record shape, ranking settings, and synonyms live in the repo (dev/algolia-index.mjs) and get reviewed like any other change. The index name stayssourcegraph_docsand has already been rebuilt on the new app with the settings in this PR, so the modal here queries live data.Build the index from the docs source (
dev/algolia-index.mjs,.github/workflows/algolia-index.yml). Records come from the contentlayer output, keyed by product fromsrc/data/navigation.ts, withproduct/section/typefacets and a page-rank weight fromseoPriority. Ranking fixes verified against the live index: no product boosts (they sat ahead of typo/attribute/exact in Algolia's ranking), product name excluded from searchable attributes sogetting startedno longer matches every record in that product, English stop words and plurals for question-style queries, synonyms (API key/access token, SSO/SAML/single sign-on, login/sign in, repo/repository, auth/authentication, perms/permissions, src-cli/src CLI), repeated boilerplate deduped by content hash, frontmatter stripped, and at most two hits per page. Result: 14,190 records across 506 pages, 1,310 duplicate blocks removed.Make the modal show results people can scan (
src/components/search/,src/data/search.ts). Results group by product with a filter chip row; each hit shows aPage › Headingbreadcrumb with the match highlighted and an icon for page / heading / content; content hits get a one-line snippet and page/heading hits get none, so 8-10 results fit above the fold instead of 4. Page and heading matches sort ahead of content matches and duplicate snippets are dropped per group. The empty state offers curated starting points, the no-results screen links to products, the highlighted result is prefetched, Ctrl/Cmd+Enter opens it in a new tab, the query mirrors into?search=so a search can be shared, and the modal is full height at 390px. Also clears the React 19 hooks lint warnings in the vendored DocSearch files (0 errors / 8 warnings, down from 39).How it looks
Query
authenticationagainst the new index: product chip row, results grouped by product,Page › Headingbreadcrumbs with the match highlighted, page / heading / content icons, one-line snippets only on content hits.Results: main vs. this PR
Top 5 hits from the Algolia REST API with the same parameters. "main" is the crawler-built
sourcegraphindex on app0EBA2NRQU3that main queries today; "this PR" issourcegraph_docsonJSZOJ0ZYVG.src repos …/src snapshot …flag tables, all the same-dump-requestsboilerplatesrc snapshot/src search-jobsflag tablesWhere main already ranked the right page first (
saml,getting started, typos), the change is that a page no longer fills the list with its own headings, so other relevant pages show up, and every hit carries its product.npx tsc --noEmitpasses;node dev/algolia-index.mjs --dry-run --statsmatches the pushed index.Follow-ups
TheThis is doneALGOLIA_ADMIN_API_KEYrepo secret must be a key for appJSZOJ0ZYVG(addObject, deleteObject, deleteIndex, settings, editSettings, browse; indicessourcegraph_docs*) or the on-merge reindex will fail. The old crawler on the DocSearch app can be paused.Research behind these changes, comparing Plain, Amp, and Cursor docs search: https://ampcode.com/threads/T-01a0b0f1-e77c-76a8-84cc-9cd012b4fb0e