Fast Mode In Search Autocomplete

Fast Mode In Search Autocomplete

Extensions Magento 2
Related Products

When a customer knows what he needs to buy, his first action is to find the product through a quick search. The presence of a quick drop-down menu with the found goods (auto-complete) allows him to find the right product quickly without leaving the search line. The customer has only to complement the search query with the necessary criteria and then he will see the result.

Autocomplete Fast Mode

Customers expect that search results will be shown instantly (they know experience of Google or Amazon search). But technically it is very hard to achieve such level of speed in Magento store. Every request to Magento needs to initiate magento core, which speed of initialization limits the speed of our search.

To solve this problem and to greatly speed up Magento search, we have created and added a new feature to our search extensions. We named it the Fast Mode.

Without fast mode

Before Fast Mode came into usage in our search extensions (Elastic Search Ultimate and Sphinx Search Ultimate), all search queries from the autocomplete passed through the entire Magento 2 query processing chain, that caused significant dropping of the query processing speed.

While the search itself takes a split of a second, the processes of primary initialization, processing, obtaining information on the found products take the lion's share of the whole time. Sometimes, it happens to take much more time than the search itself does.

For example, while search requires 0.05 sec, the time of passing the entire Magento 2 logic may be about 3-4 seconds. Also, it significantly increases the load on a server.

With fast mode

After fast mode implementing into our extensions, the processing time for queries decreased in 1000%. In this mode, the average time of results getting is about 0.12 sec.

We succeeded to achieve such a high performance result due to the exclusion of Magento 2 from the autocomplete search. At the initialization stage, the search request is intercepted and sent to a separate script, which, after a simple processing, enters the search and returns the result to the client immediately.

Expanding of products indexing process (bin / magento indexer: reindex catalogsearch_fulltext) was required. During the indexing process, in addition to the information required for the search, we save all the related product information to be displayed in the autocomplete.

Thus, the search engine, whether it is sphinxsearch or elasticsearch, can immediately return all the necessary information without Magento initializing.

Pros/Cons

The keys advantage of this approach with the fast-mode is the impressively fast search of autocomplete. The speed is improved in dozens of times!

However, the disadvantages include the increased indexing time of the search index (due to the increase in the required data), and the lack of some search capabilities, such as a long-tail, wildcard exceptions etc.

Conclusion

Quick search results are always good. However, the relevant and fast results are excellent. With our new developed option, you get not only high-quality results but also super fast results.

Related Products