Magento search optimization

Search is very important for customer experience, that is why it is highly recommended to keep it quick and optimized.

In this article we gathered recommendations that will help to optimize search in your Magento store without core files modifications.

What Magento search method is the best for my store?

Magento could be configured to use the following search methods:

Magento Community:

  • "Like" search type - Default method
  • "Fulltext" search type - Default method
  • "Combine (Fulltext and Like)" search type - Default method
  • "Sphinx" search platform - Requires 3-rd party module installation and server configuration

Magento Enterprise:

  • "Like" search type - Default method
  • "Fulltext" search type - Default method
  • "Combine (Fulltext and Like)" search type - Default method
  • "Sphinx" search platform - Requires 3-rd party module installation
  • "Apache SOLR" search platform - Default for Magento Enterprise, requires Tomcat web server installation

If you have high loaded store and have hundreds of search requests per second, you can use Sphinx or Solr search platforms for search optimization. Note that these methods will require serious server reconfiguration or even dedicated search server configuration.

How to optimize default Magento Community & Enterprise products search

By default in Magento Community & Enterprise you can activate these search methods:

  • Fulltext
  • Combine (Fulltext and Like)

Activation of these methods will not require any advanced server reconfiguration, like SOLR or Sphinx will require.

Open "System -> Configuration -> Catalog -> Catalog search" and most likely you will see that "Like" method is selected as default search method. "Like" search type is activated by default in any Magento installation.

We recommend to activate "Fulltext" search type instead of "Like", as "Like" search method is more resource heavy.
Don't forget to refresh "Catalog Search index" in the "Index Management" of your Magento store after search type changing.

Additional MySQL tuning for Fulltext search

After "Fulltext" search method activation it is recommended to:
 
1 - Increase "key_buffer_size" in your MySQL

The "key_buffer_size" is responsible for indexes buffering of MyISAM tables (such as "catalogsearch_fulltext").
 
2 - Activate MySQL query cache

You can check if MySQL query cache is activated or not, using this MySQL query:

SHOW VARIABLES LIKE 'query_cache_size'; 

For more information on how to change MySQL settings and what values to use for "key_buffer_size" and "query_cache_size" please refer to our previous article: Optimize MySQL settings for your Magento database using Tuning Primer shell script

Further reading:

MySQL Tuning Primer

Storybloks: Optimize fulltext search