feat(theme-search-algolia)!: upgrade to DocSearch v5 (AI-assisted) - #12406
feat(theme-search-algolia)!: upgrade to DocSearch v5 (AI-assisted)#124068bittitan wants to merge 3 commits into
Conversation
…ndices config (AI-assisted)
Upgrade @docsearch/react from v4 to v5 and drop the DocSearch v3
compatibility layer that was carried during the v3/v4 transition.
Changes:
- Bump @docsearch/react to ^5.0.4 and update the lockfile
- Replace `algolia.indexName` + top-level `searchParameters` with an
`algolia.indices` array (string or {name, searchParameters} entries)
- Load the search vs. Ask AI modal via dedicated dynamic entry points
- Migrate Ask AI to Agent Studio: `assistantId` -> `agentId`, per-index
`searchParameters`, and add `memory` / `promptSuggestions` options
- Convert contextual `facetFilters` into Agent Studio `filters` strings
(new facetFiltersToFilterString / mergeFilters utils)
- Remove v3 version detection, module aliases, ambient declarations, and
the ensureAskAISupported guard
- Refresh SearchTranslations for v5 labels and update tests
- Migrate website dogfooding configs to `indices` and adjust DocSearch CSS
BREAKING CHANGE: `algolia.indexName` and top-level `algolia.searchParameters`
are removed in favor of `algolia.indices`. Ask AI now uses `agentId` instead
of `assistantId`. DocSearch v3 is no longer supported.
- Who does this affect: all sites using @docusaurus/theme-search-algolia
- How to migrate: replace `indexName: 'x'` with `indices: ['x']`; move
`searchParameters` into the relevant index entry; rename Ask AI
`assistantId` to `agentId`; ensure `@docsearch/react` v5 is installed
- Why make this breaking change: DocSearch v5 drops v3 APIs and introduces
multi-index + Agent Studio Ask AI, which cannot be expressed with the old
single-index config
- Severity: high reach (every Algolia search user) x low-to-medium effort
(mostly a config rename)
|
Hi @8bittitan! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
✅ [V2]Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
- Correct lint script typo lint:SPELLING -> lint:spelling - Fix "noisey" -> "noisy" typo in webpack warning comment - Add "askai" to project-words.txt and cSpell:ignore IMYF in config - Temporarily disable translation-consistency test (it.todo); translations are deferred to a follow-up PR to keep this PR small
Motivation
Upgrades
@docsearch/reactfrom v4 to v5 and removes the DocSearch v3compatibility layer that was carried during the v3/v4 transition period.
DocSearch v5 drops the old v3 APIs and introduces multi-index search and
Agent Studio-based Ask AI, neither of which can be expressed with the previous
single-index (
indexName+ top-levelsearchParameters) configuration. This PRmigrates the theme config surface accordingly.
What changed
@docsearch/reactto^5.0.4(+ lockfile)algolia.indexNameand top-levelalgolia.searchParameterswith analgolia.indicesarray (acceptsstringor{name, searchParameters}entries)(
@docsearch/react/modal/@docsearch/react/askaiModal)assistantId→agentId, per-indexsearchParameters, and newmemory/promptSuggestionsoptionsfacetFiltersinto Agent Studiofiltersstrings(new
facetFiltersToFilterString/mergeFiltersutilities)declarations, and the
ensureAskAISupportedguardSearchTranslationsfor v5 labelsBreaking changes
@docusaurus/theme-search-algoliaindexName: 'x'withindices: ['x']searchParametersinto the relevant index entry:indices: [{name: 'x', searchParameters: {...}}]assistantId→agentId@docsearch/reactv5 is installedmulti-index + Agent Studio Ask AI, which the old single-index config cannot express
(mostly a config rename)
Bundle size
Note
There is an open issue to track removing the
@base-ui/reactdep from DocSearch here, which would reduce the overall bundles by~51 kB.Test Plan
pnpm --filter @docusaurus/theme-search-algolia buildpnpm test packages/docusaurus-theme-search-algoliapnpm --filter @docusaurus/theme-translations run update(sync catalogs)pnpm --filter website typecheckpnpm build:website:fastand manually verify search + modal open/closeTest links
Deploy preview: https://deploy-preview-12406--docusaurus-2.netlify.app/
Related issues/PRs
@docsearch/react: Allow facets to have multiple selected values algolia/docsearch#3037 lands