Skip to content

chore: upgrade to algolia sdk v4#395

Open
eric-zaharia wants to merge 16 commits intomasterfrom
chore/upgrade-to-v4-client
Open

chore: upgrade to algolia sdk v4#395
eric-zaharia wants to merge 16 commits intomasterfrom
chore/upgrade-to-v4-client

Conversation

@eric-zaharia
Copy link
Copy Markdown
Contributor

@eric-zaharia eric-zaharia commented Mar 31, 2026

Q A
Bug fix? no
New feature? no
BC breaks? yes
Related Issue API-352
Need Doc update yes

Changes

Migrated the project from Algolia SDK v3 to v4

Breaking Changes

Four user-facing breaking changes (documented in the upgrade doc):

1. SearchClient namespace moved

If you inject or type-hint SearchClient directly, update the FQCN:

- use Algolia\AlgoliaSearch\SearchClient;
+ use Algolia\AlgoliaSearch\Api\SearchClient;

The search.client service ID and autowiring alias are updated automatically.

2. $requestOptions no longer auto-detects flat HTTP headers

v3's RequestOptionsFactory auto-routed X-* keys to headers. v4 does not.

- $searchService->index($em, $entity, ['X-Forwarded-For' => '0.0.0.0']);
+ $searchService->index($em, $entity, ['headers' => ['X-Forwarded-For' => '0.0.0.0']]);

3. SearchServiceResponse::wait() no longer accepts parameters

v3 accepted $requestOptions to customize the wait behavior. v4 does not.

- $response->wait(['readTimeout' => 30]);
+ $response->wait();

4. SearchServiceResponse no longer extends AbstractResponse

SearchServiceResponse is now a standalone class. If you type-hint or instanceof check against the SDK's AbstractResponse, update to use SearchServiceResponse directly.

- use Algolia\AlgoliaSearch\Response\AbstractResponse;
- if ($response instanceof AbstractResponse) { ... }
+ use Algolia\SearchBundle\Responses\SearchServiceResponse;
+ if ($response instanceof SearchServiceResponse) { ... }

@eric-zaharia eric-zaharia self-assigned this Mar 31, 2026
@eric-zaharia eric-zaharia changed the title chore: upgrade to v4 chore: upgrade to algolia v4 Mar 31, 2026
@codacy-production
Copy link
Copy Markdown

codacy-production bot commented Mar 31, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity . 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

TIP This summary will be updated as you push new changes. Give us feedback

@eric-zaharia eric-zaharia changed the title chore: upgrade to algolia v4 chore: upgrade to algolia sdk v4 Mar 31, 2026
@eric-zaharia eric-zaharia marked this pull request as ready for review March 31, 2026 13:57
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.

1 participant