I want the search result to be more accurate when I search a product actual product is result on 3rd page

I want searched product result first then all remaining relevant products

example when i search a product MOIRÉ DOUBLE CASE - than the result get all product name that contains MOIRÉ, DOUBLE, CASE words I need product search to start with LIKE %MOIRÉ DOUBLE CASE

  • @Pramod Thank for rply but thats not working in my case I need exactly same when we search product Oct 14 '20 at 12:05
  • check my updated ans
    – Pramod
    Oct 14 '20 at 12:18
  • @Pramod I tried your code but when I search a product result get empty Your search returned no results. Oct 14 '20 at 12:38
  • did you run the di:compile after removing generated also you may check the logs for debugging purpose and please sahre the error if possible
    – Pramod
    Oct 14 '20 at 12:48

Ok try it like this

create a file search_request.xml in vendor/module/etc directory

now just copy the entire node

<request query="quick_search_container" index="catalogsearch_fulltext">

from here vendor/Magento/CatalogSearch/etc/search_request.xml

now look for this line

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

and change it like this

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

now just add dependency in your etc/module.xml

      <module name="Magento_CatalogSearch"/>

now just remove the module from setup_module table and run setup:upgrade or simply just upgrade your module version and run setup:upgrade

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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