PHPackages                             algolia/algoliasearch-adapter-magento-2 - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Search &amp; Filtering](/categories/search)
4. /
5. algolia/algoliasearch-adapter-magento-2

ActiveMagento2-module[Search &amp; Filtering](/categories/search)

algolia/algoliasearch-adapter-magento-2
=======================================

Algolia Search Adapter extension for Magento 2 - Backend rendering support

0.10.0(4d ago)3393MITPHPPHP ~8.3|~8.4|~8.5

Since Oct 29Pushed 4mo agoCompare

[ Source](https://github.com/algolia/algoliasearch-adapter-magento-2)[ Packagist](https://packagist.org/packages/algolia/algoliasearch-adapter-magento-2)[ RSS](/packages/algolia-algoliasearch-adapter-magento-2/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (2)Versions (11)Used By (0)

Algolia Search Adapter for Magento 2
====================================

[](#algolia-search-adapter-for-magento-2)

Registers Algolia as a native Magento 2 search engine and provides backend (server-side) rendering for category pages and search results. When enabled, Magento's standard product listing blocks query Algolia directly - no InstantSearch JavaScript required - making content visible to search-engine crawlers, LLM-based discovery tools, and any client that doesn't execute JavaScript.

The adapter can operate **independently** (pure server-side rendering) or **alongside InstantSearch** (server-rendered pages for bots, client-rendered for humans).

Requirements
------------

[](#requirements)

- PHP 8.2+
- Magento 2.4+ (framework `^103.0`)
- `algolia/algoliasearch-magento-2` ^3.18

Installation
------------

[](#installation)

### Via Composer (Recommended)

[](#via-composer-recommended)

```
composer require algolia/algoliasearch-adapter-magento-2
bin/magento module:enable Algolia_SearchAdapter
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:flush
```

### Manual Installation

[](#manual-installation)

1. Download the module files.
2. Place them in `app/code/Algolia/SearchAdapter/`.
3. Run the commands above starting from `module:enable`.

Enabling the Adapter
--------------------

[](#enabling-the-adapter)

> If you haven't already done so, first navigate to **Stores &gt; Configuration &gt; Algolia Search &gt; Credentials and Basic Setup**and make sure you supply your **Algolia Application ID** and corresponding API keys. The backend search adapter uses the same credentials.

1. Navigate to **Stores &gt; Configuration &gt; Catalog &gt; Catalog Search**.
2. Set **Search Engine** to **Algolia Backend Search**.
3. Adjust connection and read timeouts if needed (defaults: 2s / 5s).
4. Use the **Test Connection** button to verify connectivity.
5. Save and flush cache.

> **Note:** The adapter does NOT require InstantSearch to be enabled. It can power category and search result pages entirely on its own via server-side rendering in tandem with Magento's native layered navigation.

Backend Rendering
-----------------

[](#backend-rendering)

**Path:** Stores &gt; Configuration &gt; Algolia Search &gt; InstantSearch &gt; Backend Search Compatibility

Backend rendering controls whether Magento renders product listings on the server before delivering the page. Three modes are available:

ModeConfig ValueBehavior**No** (default)`0`InstantSearch handles all rendering client-side.**Yes (for all users)**`1`Server renders results for every request.**Yes, for specific User Agents**`2`Server renders only when the request's `User-Agent` matches the allow list.### User-Agent Allow List

[](#user-agent-allow-list)

When mode is set to **specific User Agents**, configure the allow list at:

**Path:** `algoliasearch_instant/backend/backend_render_allowed_user_agents`

Enter one user-agent string per line. Matching is **partial and case-insensitive**, e.g. `Googlebot`will match `Mozilla/5.0 (compatible; Googlebot/2.1; ...)`.

**Defaults:** `Googlebot`, `Bingbot` (one per line).

### Cache Context (`X-Magento-Vary`)

[](#cache-context-x-magento-vary)

When backend rendering is enabled for specific user agents, the module adds an `algolia_rendering_context` value (`with_backend` or `without_backend`) to Magento's `X-Magento-Vary` cookie. This tells Magento's full-page cache (FPC) to store **separate cached pages** for bot visitors vs. human visitors, so each group gets the correct rendering.

This context is only applied when InstantSearch is configured to replace category pages.

SEO-Friendly Filters
--------------------

[](#seo-friendly-filters)

**Path:** Stores &gt; Configuration &gt; Catalog &gt; Catalog Search &gt; Enable SEO Friendly Filters **Default:** Enabled

Converts Magento's internal option-ID-based filter URLs into human-readable, label-based URLs:

```
Before:  ?color=49&size=167
After:   ?color=blue&size=large

```

This is **strongly recommended** when using backend rendering alongside InstantSearch, as it ensures both rendering modes produce identical, indexable URLs.

Query String Parameter Parity
-----------------------------

[](#query-string-parameter-parity)

**Path:** Stores &gt; Configuration &gt; Algolia Search &gt; InstantSearch &gt; Backend Search Compatibility &gt; Query string parameters

This setting ensures that backend-rendered pages and InstantSearch use **identical URL parameter names**. When a crawler indexes a URL like `?product_list_order=price~asc&p=2&cat=5&price=10-50`, a human visitor opening the same URL gets identical results from InstantSearch.

Two modes are available:

ParameterAlgolia Default (`default`)Magento Compatibility (`magento`)Sorting`sortBy``product_list_order`Pagination`page``p`Category`categories``cat`Price`price.{priceKey}` with `:` separator`price` with `-` separator**Default:** Magento compatibility mode.

**How it works:** The `UpdateConfiguration` observer injects the selected parameter mapping into the InstantSearch JavaScript configuration under the `routing` key. A JS mixin (`params-manager-mixin`) reads this configuration and transforms InstantSearch's native routing to use the selected parameter names - achieving URL parity between server-rendered and client-rendered pages.

Varnish &amp; User-Agent Caching
--------------------------------

[](#varnish--user-agent-caching)

When using the **specific User Agents** rendering mode behind Varnish, be aware of an important caching interaction:

The module uses Magento's `X-Magento-Vary` cookie (via `HttpContext`) to tell the FPC to cache separate page variants for bots vs. humans. This works correctly with Magento's built-in FPC. However, **search engine crawlers do not carry cookies**, so Varnish has no `X-Magento-Vary` cookie to differentiate bot requests from human requests on cached hits.

**Result:** Varnish may serve the wrong cached variant - a human could see the bot (backend-rendered) page, or a crawler could see the JS-only page.

**Solution:** Add a custom VCL snippet that inspects the `User-Agent` header and synthesizes or overrides the vary hash for known bot user agents, ensuring Varnish serves the correct variant without relying on cookies. If you use the **Yes (for all users)** mode, this problem does not apply because every visitor gets the same server-rendered page.

Limitations
-----------

[](#limitations)

- **Landing pages** are not supported. Backend rendering applies to **category product listing pages** and **`catalogsearch/result`** only.
- **Advanced Search** is not supported at this time.

Configuration Reference
-----------------------

[](#configuration-reference)

Config PathLabelTypeDefault`catalog/search/engine`Search Engineselect-`catalog/search/algolia_connect_timeout`Connection Timeout (seconds)text`2``catalog/search/algolia_read_timeout`Read Timeout (seconds)text`5``catalog/search/algolia_seo_filters`Enable SEO Friendly Filtersyes/no`Yes``algoliasearch_instant/backend/backend_render_mode`Enable backend renderingselect`No` (0)`algoliasearch_instant/backend/backend_render_allowed_user_agents`Allowed User Agentstextarea`Googlebot`, `Bingbot``algoliasearch_instant/backend/query_string_param_mode`Query string parametersselect`magento`License
-------

[](#license)

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

###  Health Score

44

↑

FairBetter than 90% of packages

Maintenance86

Actively maintained with recent releases

Popularity21

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 85.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~63 days

Total

3

Last Release

4d ago

PHP version history (2 changes)0.9.0PHP ~8.2|~8.3|~8.4

0.10.0PHP ~8.3|~8.4|~8.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/5397bc3560b352fd4f77e2b15e0e3fc59e1a189e4316b41e5c6b1cac177264cd?d=identicon)[damcou](/maintainers/damcou)

![](https://www.gravatar.com/avatar/e6493af93837af8fa9f24f0714353c27b4646ebe07c027c36fc46d1b47060da2?d=identicon)[cammonro](/maintainers/cammonro)

---

Top Contributors

[![cammonro](https://avatars.githubusercontent.com/u/986313?v=4)](https://github.com/cammonro "cammonro (182 commits)")[![damcou](https://avatars.githubusercontent.com/u/1649459?v=4)](https://github.com/damcou "damcou (30 commits)")

### Embed Badge

![Health badge](/badges/algolia-algoliasearch-adapter-magento-2/health.svg)

```
[![Health](https://phpackages.com/badges/algolia-algoliasearch-adapter-magento-2/health.svg)](https://phpackages.com/packages/algolia-algoliasearch-adapter-magento-2)
```

###  Alternatives

[blackbird/module-hyva-algolia-search

Blackbird\_HyvaAlgoliaSearch makes Algolia\_AlgoliaSearch compatible with Hyvä Themes

1422.0k](/packages/blackbird-module-hyva-algolia-search)[awesome-nova/dependent-filter

Dependent filters for Laravel Nova

26193.1k](/packages/awesome-nova-dependent-filter)[algolia/php-dom-parser

A simple tool to turn DOM into Algolia search friendly record objects.

181.8k](/packages/algolia-php-dom-parser)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
