Download the PHP package freento/fast-search-autocomplete without Composer

On this page you can find all versions of the php package freento/fast-search-autocomplete. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package fast-search-autocomplete

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.

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

Plan to achieve the goals:

Installation

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

  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

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

Basic module setup:

  1. Switch the module to "Direct Elastic" mode. (Stores > Configuration > Freento > Fast Search Autocomplete > General > Mode)
  2. Generate a configuration file. (Stores > Configuration > Freento > Fast Search Autocomplete > General > 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:

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

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

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

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:

All versions of fast-search-autocomplete with dependencies

PHP Build Version
Package Version
Requires php Version ~8.0.0 || ~8.1.0 || ~8.2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package freento/fast-search-autocomplete contains the following files

Loading the files please wait ....