zero1/search-query-optimization

1.0.2 2023-05-18 11:55 UTC

This package is auto-updated.

Last update: 2024-04-18 13:49:43 UTC


README

Description

This module is designed to optimize a few things around the "suggested search terms" returned by Magento when typing in the search bar at the top of the page. The current optimizations are:

  • increase default cache size of these results from 100 => 1000
  • implements a decay functionality to the search_query table (see Decay Function)

Decay Function

When a user searches for a term, Magento adds this term to the search_query table. When another search for the same term happens Magento increments the popularity of the term. This allows Magento to return "the most popular" results for the term being searched for. However Magento does not implement any way of clearing down these search terms automatically, leaving you with a table that only ever grows. Which means the response time will increase (larger table ~= longer response times).

This module runs a cronjob every minute that looks for any records that haven't been used in the last "Decay Days" (see settings), don't have a redirect and haven't been processed. It will then decrement the popularity of the term. If the term is at popularity 0, it will be removed from the table.

Settings

Name Location Default Value Description
Decay Days Stores => Configuration => Catalog Catalog => Catalog Search 30

Commands

Decay

The decay function can be ran manually

php bin/magento zero1:search-query-optimization:decay