RSS

How to search for all words in magento?

26 Sep

If u want to make an AND search instead of OR, you will need to rewrite the class

Mage_CatalogSearch_Model_Resource_Fulltext

at this location in magento v1.7.0.2.

app/code/core/Mage/CatalogSearch/Model/Resource/Fulltext.php

Now Go to the following function in this file

public function prepareResult($object, $queryText, $query)

You have to change the following line

$likeCond = '(' . join(' OR ', $like) . ')';

To

$likeCond = '(' . join(' AND ', $like) . ')';

Now change the Search Type to “LIKE” from catalog search section in admin.

Now reindex the search index afterwards to have an effect..

 
1 Comment

Posted by on Sep 26, 2013 in Magento, Mysql, PHP

 

Tags: , , , , , , , , , , ,

One response to “How to search for all words in magento?

  1. Ali

    Apr 21, 2014 at 6:10 pm

    Nice article. Very informative… keep it up…

     

Leave a comment