PHPackages                             freento/fast-search-autocomplete - 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. freento/fast-search-autocomplete

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

freento/fast-search-autocomplete
================================

Freento Fast Search Autocomplete

1.0.0(2y ago)026PHPPHP ~8.0.0 || ~8.1.0 || ~8.2.0

Since Sep 1Pushed 2y ago1 watchersCompare

[ Source](https://github.com/Freento/fast-search-autocomplete)[ Packagist](https://packagist.org/packages/freento/fast-search-autocomplete)[ RSS](/packages/freento-fast-search-autocomplete/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Problem
-------

[](#problem)

Magento's autocomplete feature works quite slowly. Users expect almost instant responses when entering text in the search input. Additionally, Magento does not display products as a result of search queries.

Module Goal - Achieve near-instant input, around 50ms.
------------------------------------------------------

[](#module-goal---achieve-near-instant-input-around-50ms)

Additional goal - display products as a result of search queries.

### Plan to achieve the goals:

[](#plan-to-achieve-the-goals)

- Abandon auxiliary SQL queries, implement only with Elastic.
- Avoid additional network interactions (Redis, SQL).
- Avoid Magento bootstrap.

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

[](#installation)

1. Install module: `composer require freento/fast-search-autocomplete`
2. Run magento commands:

```
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:clean
```

3. To populate the attribute required for operation take an action of your choice:
    1. Run CLI command `bin/magento freento:fsa:fillname`.
    2. Wait for the "freento\_fastsearchautocomplete\_fill\_original\_name" cron job execution (it runs once a day).
4. Reindex or wait for Magento to do it automatically.

Module Operation Modes
----------------------

[](#module-operation-modes)

### Fast Mode (Direct Elastic)

[](#fast-mode-direct-elastic)

All Magento AJAX controller queries are quite slow because they do not trigger FPC and:

1. Go through Magento bootstrap, composer autoload.
2. Require caching data retrieval from Redis or the file system.
3. Perform about a dozen MySQL queries.

For example, the simplest native Magento search query for autocomplete makes about 30 Redis and 10 MySQL queries and takes 135 milliseconds.

Our module has a Fast mode that makes a direct request to Elasticsearch without invoking Magento's bootstrap. This is achieved by uploading a simple script to the server's pub folder responsible for high-speed operation. The response from Magento comes in tens of milliseconds.

#### Demo: [Fast Search Autocomplete Demo](https://fast-search-autocomplete-demo.freento.com)

[](#demo-fast-search-autocomplete-demo)

#### Basic module setup:

[](#basic-module-setup)

1. Switch the module to "Direct Elastic" mode. (Stores &gt; Configuration &gt; Freento &gt; Fast Search Autocomplete &gt; General &gt; Mode)
2. Generate a configuration file. (Stores &gt; Configuration &gt; Freento &gt; Fast Search Autocomplete &gt; General &gt; Generate Search Configuration File)
3. Copy the basic file from the misc folder of the extension to the pub folder (`pub/search_result.php`), which does not bootstrap Magento but works directly with Elasticsearch.
4. Adjust the server configuration to allow the module to access the file from step 3. Example from nginx.conf:

```
...
# PHP entry point for main application
location ~ ^/(index|get|static|errors/report|errors/404|errors/503|health_check|search_result)\.php$ {
    try_files $uri =404;
    fastcgi_pass   fastcgi_backend;
    fastcgi_buffers 16 16k;
    fastcgi_buffer_size 32k;

    fastcgi_param  PHP_FLAG  "session.auto_start=off \n suhosin.session.cryptua=off";
    fastcgi_param  PHP_VALUE "memory_limit=756M \n max_execution_time=18000";
    fastcgi_read_timeout 600s;
    fastcgi_connect_timeout 600s;

    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    include        fastcgi_params;
}
...

```

### Native Magento mode

[](#native-magento-mode)

It operates similarly to the "Direct Elastic" mode but involves Magento's bootstrap, which is not very fast and also makes additional MySQL and Redis queries. To switch to this mode, simply select "Native Magento" under Stores - Configuration - Fast Search Autocomplete.

Technical Notes
---------------

[](#technical-notes)

### Attribute

[](#attribute)

Since Elasticsearch stores names for configurable and bundle products as a string containing the names of all included simples, a separate attribute was added to display normal product names in the results. This attribute is filled in when a product is saved or through the cron job `freento_fastsearchautocomplete_fill_original_name` or by running the CLI command

`bin/magento freento:fsa:fillname`.

Without filling this attribute, the search will not work correctly.

### Redirect to Product Page

[](#redirect-to-product-page)

To navigate to a product page, the product's ID is used instead of a direct link. When a result is clicked, it redirects to a controller where the product's page URL is generated based on the product's ID (or a noroute page if the product cannot be found by ID), and then redirects to the correct page.

### Fast mode specifics

[](#fast-mode-specifics)

The search occurs in the `pub/search_result.php` file. If you need more flexible rules for the Elastic request, you can modify the file, but usually it is not required and autogenerated file is fine. Magento's indexer does not store product URLs. In the popup, there are links to an intermediate controller, and upon navigating to it, the correct product URL is determined, and a redirect to the correct page occurs.

The file uses a generated config file with the following fields. If there are any errors when connecting to Elasticsearch, check this file (`var/freento-elastic-config.json`).

##### Configuration file sample:

[](#configuration-file-sample)

```
{
    "hostname": "localhost",
    "port": "9200",
    "index": "magento2",
    "enableAuth": "0",
    "username": "",
    "password": "",
    "timeout": "15",
    "engine": "opensearch",
    "max_results_count": "10"
}
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

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

Unknown

Total

1

Last Release

981d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/98f431f566f9a6d2cbe0e346430548851a8aba22f9bdf8efef8429a549b84513?d=identicon)[Freento](/maintainers/Freento)

### Embed Badge

![Health badge](/badges/freento-fast-search-autocomplete/health.svg)

```
[![Health](https://phpackages.com/badges/freento-fast-search-autocomplete/health.svg)](https://phpackages.com/packages/freento-fast-search-autocomplete)
```

###  Alternatives

[ruflin/elastica

Elasticsearch Client

2.3k50.4M202](/packages/ruflin-elastica)[opensearch-project/opensearch-php

PHP Client for OpenSearch

15024.3M64](/packages/opensearch-project-opensearch-php)[mailerlite/laravel-elasticsearch

An easy way to use the official PHP ElasticSearch client in your Laravel applications.

934529.3k2](/packages/mailerlite-laravel-elasticsearch)[massive/search-bundle

Massive Search Bundle

721.4M13](/packages/massive-search-bundle)[shyim/opensearch-php-dsl

OpenSearch/Elasticsearch DSL library

175.9M9](/packages/shyim-opensearch-php-dsl)[outl1ne/nova-multiselect-filter

Multiselect filter for Laravel Nova.

45802.7k3](/packages/outl1ne-nova-multiselect-filter)

PHPackages © 2026

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