My experience has shown me that the default Magento search is really bad, it doesn’t matter if you’re using the Community version or the Enterprise one: search results are always bad, even if you don’t have too many products in your catalogue (less than 200). Here are some tips on how to improve the search:

  • First of all, check the search type in your backoffice (System » Configuration » Catalog » Catalog search). By default, Magento uses mysql “LIKE”, you can try combining “LIKE and FULLTEXT”. Don’t use fulltext only, because unless you search for the exact word, you won’t get any results. 
  • If you’re using Magento Enterprise, you should definitely enable Solr (it’s easier than it could initially seem, but final results are great). I’m writing a quick guide that I haven’t finished. In the meanwhile, take a look at this.
  • Another interesting extension I’ve just run into is the «Catalog Search Refinement», it claims to improve the search results. I’ll try it out (it says it’s compatible by default with Magento latest versions).
  • You could try with some extensions that claim to improve Magento search. Most of them aren’t free. But the good news is that I have found a specific extension, for free, kind of old, but that actually improves the search results. The name of this extension is «Enhanced Search» and you can grab it from Magento Connect. Even though it says it’s only compatible with Magento 1.1, the truth is that I have tried it with a Magento 1.6 and 1.11, and it works (and I’m pretty sure it will work with 1.7 and 1.12 as well).

Some Thoughts

It is really annoying that the Magento default search system works so bad. Even getting a collection and filtering it by attributes using some like expression, works much better than the default search. For example:


$productsCollection = Mage::getResourceModel('catalog/product_collection')
 ->addAttributeToFilter('type_id', array('eq' => 'simple'))
 ->addAttributeToFilter('status', array('eq' => '1'))
 ->addAttributeToFilter(
 array(
 array('attribute'=>'name', 'like'=>'%'.$search.'%'),
 array('attribute'=>'sku', 'like'=>'%'.$search.'%')
 )
 );

How can this be possible? Is it the Magento indexing system? MySQL? The number of products? In any case, Magento should improve this super-bug, because it makes no sense.


16 Comments

chiefair · June 24, 2012 at 6:22 pm

Yep. The first thing is to change the ‘LIKE’ search back to AND logic instead of OR and trim the trailing ‘s’ off of words. Too many people search for plural of the item they’re looking for, you describe it as a single item because you sell it by the item. Then synonym all the rest of the oddball plurals ending in ‘ies’, ‘es’, etc. to the singular. Works wonders at getting the search results to start meaning something.

The other is to change the ‘LIKE’ reindex to catenate the different search attributes you’ve included into the search index with spaces between the attributes. They boneheadedly insert without the space and you end up losing search word matches to this.

Justin · July 5, 2012 at 2:58 pm

Any idea how to get products tags to show up in search? I enabled them in admin and attached them to the products but when you search for them it gives no results. but in you click on the tag under Popular Tags on the front end it brings you right to the product.

    Pau · July 5, 2012 at 3:51 pm

    Hi Justin,

    Sadly, it seems that there is no an easy way for using the tags when searching. I would recommend creating a custom product attribute that you will use as a tag, so you can just simply add your tags in there and make the attribute searchable.

Re:Designed · July 31, 2012 at 1:29 am

I have a clients site that won’t allow us to enter spaces into the search field. Any ideas how to fix this?

The site is: http://urbanbabybonnets.com

    Pau · July 31, 2012 at 7:04 am

    It’s weird. I guess that probably there is a javascript avoiding that. Look for it!

Bill · December 1, 2012 at 7:54 pm

In fact, Magenta search is not perfect. Very often a user doesn’t find what he was looking for and leaves the store. Good decision is to integrate the Sphinx search engine. It greatly improves the quality and relevance of search results. Look at http://mirasvit.com/magento-extensions/magento-sphinx-search.html. You can download the trial version for free, install it to your website and make sure that the search quality is greatly improved.

Search in Google “Magento Advanced Sphinx Search Pro”. There are good ready-made solutions to address the problem.

Fabrice · January 25, 2013 at 11:48 am

I tried the extension Enhanced on my local Magento and it didn’t work. (version 1.7.0.2). So I tried that extension http://www.magentocommerce.com/magento-connect/catalog-search-refinement.html which work very well : install, reindex catalogsearch and enjoy !

Thanks anyway for your post !

Chhotusingh · April 4, 2013 at 6:49 am

Not getting left catalog navigation bar when enabled solr search in magento EE.

James Simpson · May 23, 2013 at 2:01 pm

Yes I have to agree the standard search is a bit shocking on Magento, I have yet to find a decent plugin which will help more. I seem to find myself looking at the search terms, and then re-directing users into the correct location, even adding product tags, and re-directing the customers to those tags.

Yoav · July 2, 2013 at 1:45 pm

implementing Google search seems to be the better choice for our site.
http://www.magebuzz.com/blog/2012/07/09/how-to-add-google-custom-search-into-magento/
or live demo on this store http://careandheal.com/

    Pau · July 5, 2013 at 5:24 am

    Hi Yoav,

    I’ve seen that search in action and I don’t really think it’s better. The results don’t contain images and Google titles and descriptions (extracted from the website metadata) don’t seem to be good either.

    I’ll post about a new search!

Patricia Gonzalez (@Corzara) · December 17, 2013 at 2:10 pm

Thank you very much for this article, it helped me a lot 🙂

Martin Barker · April 14, 2015 at 6:24 pm

Where the fooking hell is the code snippet from? what file im gonna mod the fook out of it

    Guilherme Nemeth · January 18, 2016 at 1:30 pm

    inside the function “prepareProductCollection” at
    app/code/core/Mage/CatalogSearch/Model/Layer.php

Leave a Reply

Your email address will not be published. Required fields are marked *