cancel
Showing results for 
Search instead for 
Did you mean: 

Customizing Product Search Query

Customizing Product Search Query

Hello. The search function on my website is not working very well. The search is returning many products that have nothing to do with term that I searched about. I believe that the search is getting products that have any of the terms, but it would be better to get just the products that have all the terms. For instance, if the client searches for "blue car", the search return all products with the word blue on the name, and all produtcs with the word car in the name, like "blue box" and "car keys", for example.

 

I am thinking about altering the product search query, exploding the user input and getting the products with a LIKE relation, for instance "select * in products where name like blue and name like car". Is it a good solution for the problem? Is there any other way, like fiddling with the settings of the store so the search works properly? If there isn't any other way, where can I make the alterations on the code? I've been looking in the /app/code/core/Mage/CatalogSearch/, but I can't seem to find where are the database queries are made.

Thank you all in advance.

2 REPLIES

Re: Customizing Product Search Query

Hello @Charles Albert

As an alternative, you can check out search extensions for Magento. For example. this one https://amasty.com/search-pro.html

It lets to choose the search type – ‘like’, ‘fulltext’ or ‘combined’ and also adds autocomplete feature.

Was my answer helpful? You can accept it as a solution.
200+ professional extensions for M1 & M2 with free lifetime updates!

Re: Customizing Product Search Query

thanks for the tip, but we are trying to solve the problem internally. maybe in the future we are going to need something like this, but not now.