Magento 2 Search Query – How to Optimize

magento2search

I have faced the problem in using Magento2 with search result commonly search based on SKU but I want to search product using the name of the product so I want to change the search query in Magento2 but I am not found any option in admin section and code file so can anybody help me to change search query.

Best Answer

For that, i suggest you to override the core catalog_search and search module first and then you can get solution inside the model folder.

Check this 2 files: vendor/magento/module-catalog-search/Model/Layer/Search/Plugin/CollectionFilter.php afterFilter(){}

vendor/magento/module-search/Model/Query.php getSuggestCollection(){}

Hope this can be helpful.

Thanks

Related Topic