Blog

How to get the exact search result in magento

  • Saurabh Sutariya
  • July 10, 2015

Hello Friends,

I have seen many posts but i can’t find the exact solution for this issue and then i have investigate code of the default magento. So Please follow the below steps for getting the exact result as you want.

1. Go to app/code/core/Mage/CatalogSearch/Model/Resource/fulltext.php
2. Then search the below code it is approximately at 382 line

if ($likeCond != '' && $searchType == Mage_CatalogSearch_Model_Fulltext::SEARCH_TYPE_LIKE) {
    $select->columns(array('relevance'  => new Zend_Db_Expr(0)));
    $where = $likeCond;
}

3. And change with the below code.

if ($likeCond != '' && $searchType == Mage_CatalogSearch_Model_Fulltext::SEARCH_TYPE_LIKE) {
     $select->columns(array('relevance'  => new Zend_Db_Expr(0)));
    //$where = $likeCond;
    $where .= ($where ? ' AND ' : '') . $likeCond;
}

4. Clear all the cache.

After following the above steps, please search any product name and you will get the exact product which you want.

I hope this is really help you.

Thanks,

Want to work with us?

We love meeting new people. Let us know how we can help you.

Magespider Infoweb Pvt. Ltd.

Contact us to get a quick quote!

captcha