Skip to content

Conversation

@8bittitan
Copy link
Contributor

@8bittitan 8bittitan commented Aug 27, 2025

What

Adds support for multi-index search during keyword search. This does not impact AskAI in any way.

  • Add new indices property to accept a list of indexes for search
  • Add deprecation messaging to indexName and searchParameters properties
  • Manage backwards compatibility for now until indexName and searchParameters are fully removed
  • Add another example of multi-index search

Docs

  • Adds documentation for indices and deprecation warnings for indexName and searchParameters
  • Enables respectPrefersColorScheme within Docusaurus config
indices_js_docs indices_react_docs index_name_deprecation search_parameters_deprecation

Dependencies

  • Add documentation around new and deprecated properties

@netlify
Copy link

netlify bot commented Aug 27, 2025

Deploy Preview for docsearch ready!

Name Link
🔨 Latest commit 5855b55
🔍 Latest deploy log https://app.netlify.com/projects/docsearch/deploys/68b7099d6851890008e0008d
😎 Deploy Preview https://deploy-preview-2736--docsearch.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@8bittitan 8bittitan merged commit 905e26d into main Sep 2, 2025
10 checks passed
@8bittitan 8bittitan deleted the feat/add-multi-index-support branch September 2, 2025 15:18
Copy link
Contributor

@slorber slorber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reporting a retro-compatibility issue we got after upgrading from beta.8 to GA

Please tell us if you plan to restore API retro-compatibility for subcomponents too, or if we now have to handle this retro-compatibility ourselves.

Comment on lines +218 to +236
// Format the `indexes` to be used until `indexName` and `searchParameters` props are fully removed.
const indexes: DocSearchIndex[] = [];

if (indexName && indexName !== '') {
indexes.push({
name: indexName,
searchParameters,
});
}

if (indices.length > 0) {
indices.forEach((index) => {
indexes.push(typeof index === 'string' ? { name: index } : index);
});
}

if (indexes.length < 1) {
throw new Error('Must supply either `indexName` or `indices` for DocSearch to work');
}
Copy link
Contributor

@slorber slorber Sep 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I understand, this fallback logic only applies when using <DocSearch>, but it doesn't apply when using <DocSearchButton> and <DocSearchModal> directly, like Docusaurus does.

Unfortunately, this PR broke the DocSearch v3/v4 retrocompatibility we expected for Docusaurus, and upgrading from beta8 to GA makes the search unusable: facebook/docusaurus#11327

translations={props?.translations?.modal}
isAskAiActive={isAskAiActive}
canHandleAskAi={canHandleAskAi}
indexes={indexes}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is DocSearch prop named indices, while subcomponents accept an indexes prop? Isn't that a typo? Why not always a consistent name?

Comment on lines +354 to +366
describe('Indexes', () => {
it('renders with deprecated indexName prop', () => {
expect(() => <DocSearch indexName="My test Index" />).not.toThrowError();
});

it('renders with new indices prop', () => {
expect(() => render(<DocSearch indexName={undefined} indices={[{ name: 'testing' }]} />)).not.toThrowError();
});

it('throws an error if indexName or indices are not provided', () => {
expect(() => render(<DocSearch indexName={undefined} indices={[]} />)).toThrowError();
});
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those tests only cover the root API, but do not cover <DocSearchButton> and <DocSearchModal> APIs

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.

5 participants