GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — search-bundle/UPGRADE-8.1.md at master · algolia/search-bundle

Expand file tree

/

UPGRADE-8.1.md

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
186 lines (145 loc) · 5.27 KB
/

UPGRADE-8.1.md

Copy path

File metadata and controls

186 lines (145 loc) · 5.27 KB
Raw
Copy raw file
Download raw file
Outline
Edit and raw actions

Upgrading from 8.0.0 to 8.1.0

The SearchBundle now uses the Algolia PHP API Client v4. This is a significant upgrade of the underlying SDK that introduces a few breaking changes.

Upgrade your algolia/search-bundle dependency to ^8.1 in your composer.json file and run composer update algolia/search-bundle algolia/algoliasearch-client-php in your terminal.

SearchClient namespace

The SearchClient class has moved to a new namespace. If you inject or type-hint SearchClient in your own services, update the fully qualified class name.

Before:

use Algolia\AlgoliaSearch\SearchClient;

After:

use Algolia\AlgoliaSearch\Api\SearchClient;

The bundle's DI alias has been updated accordingly:

Before:

services:
    App\Service\MyService:
        arguments:
            $client: '@Algolia\AlgoliaSearch\SearchClient'

After:

services:
    App\Service\MyService:
        arguments:
            $client: '@Algolia\AlgoliaSearch\Api\SearchClient'

If you autowire by type-hint, update your constructor or method signatures:

Before:

public function __construct(\Algolia\AlgoliaSearch\SearchClient $client) {}

After:

public function __construct(\Algolia\AlgoliaSearch\Api\SearchClient $client) {}

Request options format change

In v3, custom HTTP headers could be passed as flat top-level keys in $requestOptions. In v4, flat keys are silently ignored. HTTP headers must be nested under the headers key.

Before:

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

After:

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

This applies to all SearchService methods that accept $requestOptions: index(), remove(), clear(), delete(), search(), rawSearch(), and count().

The recognized top-level keys for $requestOptions in v4 are:

  • headers — Custom HTTP headers (associative array)
  • queryParameters — Extra URL query parameters (associative array)
  • body — Extra body parameters (associative array)
  • readTimeout — Read timeout in milliseconds (int)
  • writeTimeout — Write timeout in milliseconds (int)
  • connectTimeout — Connection timeout in milliseconds (int)

SearchServiceResponse::wait() no longer accepts parameters

In v3, SearchServiceResponse::wait() accepted $requestOptions to customize the wait behavior (e.g. timeout). In v4, waiting is handled internally by the SDK's SearchClient::waitForTask() method and no longer accepts parameters.

Before:

$response = $searchService->index($em, $entities);
$response->wait(['readTimeout' => 30]);

After:

$response = $searchService->index($em, $entities);
$response->wait();

SearchServiceResponse no longer extends AbstractResponse

SearchServiceResponse was a subclass of the SDK's Algolia\AlgoliaSearch\Response\AbstractResponse in v3. That class no longer exists in v4. SearchServiceResponse is now a standalone class in the bundle's own namespace.

If you type-hint or instanceof check against AbstractResponse, update your code:

Before:

use Algolia\AlgoliaSearch\Response\AbstractResponse;

if ($response instanceof AbstractResponse) { ... }

After:

use Algolia\SearchBundle\Responses\SearchServiceResponse;

if ($response instanceof SearchServiceResponse) { ... }

List of changes in fully qualified namespaces

8.0.0 Breaking Change 8.1.0
Algolia\AlgoliaSearch\SearchClient Moved Algolia\AlgoliaSearch\Api\SearchClient
Algolia\AlgoliaSearch\Response\AbstractResponse Removed Algolia\SearchBundle\Responses\SearchServiceResponse (no longer a base class)
Algolia\AlgoliaSearch\Response\IndexingResponse Removed Algolia\SearchBundle\Responses\EngineResponse
Algolia\AlgoliaSearch\Response\BatchIndexingResponse Removed Handled internally by SearchServiceResponse
Algolia\AlgoliaSearch\Response\NullResponse Removed Algolia\SearchBundle\Responses\NullResponse
Algolia\AlgoliaSearch\Support\UserAgent Removed Algolia\AlgoliaSearch\Support\AlgoliaAgent

List of updated public services names

8.0.0 Breaking Change 8.1.0
Algolia\AlgoliaSearch\SearchClient (autowiring alias) Renamed Algolia\AlgoliaSearch\Api\SearchClient
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.