Instant Search Autocomplete for Magento 2
When a customer knows what he or she needs to buy, his or her first act is to look up the desired product through a quick search.
The presence of a quick drop-down menu with the detected products (auto-complete) allows the customer to find the right product quickly without leaving the search line.
The customer has only to complement the search query with the necessary criteria in order to see the results.
Customers expect that search results will be shown instantly (typically based on their experience with Google or Amazon searches). On a technical level, however, it's actually very hard to achieve such a level of speed in the Magento 2 store.
Every request to Magento needs to initiate Magento core, whose speed of initialization limits the speed of our search.
To solve this problem and greatly speed up the Magento search, we have created and added a new feature to our search extensions, which we named 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, which caused a significant drop in the query processing speed.
While the search itself takes less than a second, the processes of primary initialization, processing, obtaining information on the detected products take the lion's share of the time spent.
Sometimes it can end up taking much more time than the search itself does.
With fast mode
After implementing fast mode into our extensions, the processing time for queries decreased by 1000%. In this mode, the average amount of time to get results is about 0.12 sec.
We succeeded in achieving such high-performance results 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 some simple processing, enters the search and returns the result to the client immediately.
Expanding of the 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 related product information to be displayed in the autocomplete.
Thus, the search engine, whether a sphinx search or elasticsearch, can immediately return all the necessary information without Magento initializing.
The keys advantage of this approach with the fast-mode is the impressively fast search of autocomplete. The speed is improved by 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 certain search capabilities, such as a long-tail, wildcard exceptions, etc.
Quick search results are always good. However, relevant and fast results are even better.
With our newly developed option, the results you get are not only high in quality, but also super-fast.
Speed up the search process on your online store with our Search AutoComplete & Suggest Pro! Our extension allows you to perform fast and precise predictions when completing a word or phrase for your customer while searching for a product. Turn your store visitors' shopping activities into a pleasant experience - offer them the most appropriate options for their online purchase with our Search AutoComplete & Suggest Pro!