0

Using Magento 2.1.10

The search part of Magento 2 seems quite buggy. I have a product titled "abc with xyz".

  1. When I search "abc", the product gets displayed but its pushed in between the collection, with several items appearing before it, which does not even have "abc" in their names. I researched and adjusted the search weights and i still get the same result, no effect at all.
  2. When I search "abc lights", the result is similar to point 1
  3. When I search "with", I do not see the product listed. Other products which are irrelevant gets displayed

How can i search the products by NAME only. I have tried disabling the searchable for all the other Attributes. in this case when i search "with", I get no result at all.

I have already tried changing the query clause to "must" instead of "should", but it still does not work

If possible, can someone please let me know where can I find the query in the code for it.

2 Answers 2

0

I know this might not answer your question in 100% but I can't recommend enough to use the elasticsearch.

It improves the quality of search for Magento 2.

There is a free extension you can use. You can find it here: https://github.com/Smile-SA/elasticsuite

0

If you want to stick to Magento's default search and want to search by NAME field only, then you must stop other attributes to appear in the search filter criteria.

To do this:

  1. Go to Stores >> Attributes (Product).
  2. Search for Searchable = Yes in the attributes grid.
  3. Open all these attributes one by one (except the Name attribute) and set Use in Search to No under Storefront Properties tab.
  4. After finishing the above step, reindex and flush Magento's cache.

Try searching the frontend now.

This solution worked for me in the last 3 websites.

Please share if you find any better solution.

4
  • I have tried that as well. And its works as expected. But it does not resolve the 3rd point, which is that a product with name "abc with xyz", when i search "with", the product does not appear.. but when i search "abc" it does. Commented Nov 6, 2018 at 11:41
  • It should work. I have just tried in the default installation of Magento with sample data. It is working fine here. Commented Nov 6, 2018 at 11:49
  • For example, if I search for Radiant Tee, it is showing the product Radiant Tee at first place and then the products with any of the parts of search criteria individually. Commented Nov 6, 2018 at 11:50
  • i'm checking with following step but its not working my side. Commented May 30, 2019 at 11:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.