cancel
Showing results for 
Search instead for 
Did you mean: 

Quick search by SKU showing unrelated products

   Did you know you can see the translated content as per your choice?

Translation is in progress. Please check again after few minutes.

Quick search by SKU showing unrelated products

Hi,

 

I've been trying to solve this problem for a while but without any success, so I guess the best option is to ask the community. I have a store on Magento 2.3.2 and all my products have an SKU like xx-xx, where x is a number (01-12, 04-18, 10-71 etc).

 

The problem is when I'm trying to search by SKU in top search bar I get absolutely unrelated results, for example if I search for "10-71" I'll get "16-57", "16-43", "13-95" and even "02-04", but there's no "10-71" in whole search results. Same issue occurs if I search for any other SKU. How could that be?

 

SKU attribute has highest search weight, I reindexed catalog, cleaned cache etc.

3 REPLIES 3

Re: Quick search by SKU showing unrelated products

Hi @Miguel_,

Magento 2 generally use like search

Try once with following solution for full text search.

You have to extend vendor/magento/module-catalog-search/etc/search_request.xml file
in custom module.
and change line 16:

 

<queryReference clause="should" ref="search" /> 
to <queryReference clause="must" ref="search" />


I hope it will help you!

Re: Quick search by SKU showing unrelated products

@Vimal Kumar Thanks, doesn't help, unfortunately.

 

What's interesting is that same Magento build searches by SKU on my localhost, but has the issue described above as soon as I upload it on production server.

Re: Quick search by SKU showing unrelated products

Strange... Then definitely something wrong on the server.

Check cookie path on the server once.
Store->Configuration->General->Web default cookies setting.

I don't think it will be issue..just guess.