Showing results for 
Search instead for 
Did you mean: 

Wildcard SKU results in quick search

0 Kudos

Wildcard SKU results in quick search

Feature request from cowmix88, posted on GitHub Feb 08, 2017


  1. Magento 2.1.3
  2. PHP 7.0.13
  3. MySQL 5.6

Steps to reproduce

  1. Create an item with SKU# SDF3123
  2. Do a quick search for 3123

Expected result

  1. Search returns product SDF3123

Actual result

  1. Search returns no products.

Note: Advanced search with a SKU of 3123 does work correctly. Also SDF312 works in quick search so it appears the wildcard character is only being applied to the end of the search string.

Is there any easy way to edit search_request.xml to achieve the desired result?

New Member

Comment from maghamed, posted on GitHub Feb 09, 2017

Hi @cowmix88 ,

Actually behavior you described is expected one. Creating item with SKU# SDF3123 and making quick search for 3123 would not produce any results. And here is why: both MySQL and Elasticsearch make full text search to get data from index. Your indexed phrase is "SDF3123" which is stored as one word, there is no any tokenizer which will process it and save separately (as two individual words), so it's stored as-is. Full text search is a search by the whole word or part of the word from the beginning. So, in your case such search phrases will produce results:

  • SDF3123
  • SDF31
  • SDF

Actually your search phrases send to search adapter as "{search_phrase}*". But in your example you would like to make next filtering "*{search_phrase}".

Similar to MySQL Like functionality - LIKE %searchterm% Magento doesn't support this kind of search because of performance reasons. Such queries are very slow, because index is not used and MySQL should look through all the records in the table.

Regular Visitor

Hello, all.



Anybody knows how it is possible to change in to LIKE %searchterm% statement?