Magento search not working properly, how to improve search results?

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.

    • chiefair on June 24, 2012 at 6:22 pm

    Reply

    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 on July 5, 2012 at 2:58 pm

    Reply

    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 on July 5, 2012 at 3:51 pm
      • Author

      Reply

      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.

  1. Reply

    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 on July 31, 2012 at 7:04 am
      • Author

      Reply

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

    • Bill on December 1, 2012 at 7:54 pm

    Reply

    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 on January 25, 2013 at 11:48 am

    Reply

    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 !

      • Pau on January 25, 2013 at 12:19 pm
      • Author

      Reply

      Thanks for the recommendation, Fabrice. This was on the list already, though 😉

      • p on March 6, 2014 at 10:31 am

      Reply

      Hello

      I have the same problem on my site (cant do spaces in search field) http://www.toner123.si. Was this your solution:

      http://www.magentocommerce.com/magento-connect/catalog-search-refinement.html

      or maybe somethin else.

      Thanks and best regards

    • Chhotusingh on April 4, 2013 at 6:49 am

    Reply

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

  2. Reply

    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 on July 2, 2013 at 1:45 pm

    Reply

    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 on July 5, 2013 at 5:24 am
      • Author

      Reply

      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!

  3. Reply

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

  4. Reply

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

      • Guilherme Nemeth on January 18, 2016 at 1:30 pm

      Reply

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

Leave a Reply

Your email address will not be published.