I’m encountering a challenge with the search functionality in Magento 2 and could use your expertise. Specifically, the issue revolves around partial match searches, especially concerning the SKU attribute. 🔎🛒
Issue Description:
- When I search with the exact SKU (e.g.,
"ML1797"
), the product is
retrieved as expected in the search results. ✅ - However, when I perform a search with a partial SKU (e.g.,
"1797"
),
no results are found, which is not the desired outcome. ❌
Objective:
- I want to configure or customize the search functionality so that partial SKU searches return relevant results.
What I’ve Tried:
- I’ve ensured that the SKU attribute is set to
"Use in Search"
underStores > Attributes > Product > SKU
. - I’ve reindexed and cleared cache after making configuration changes.
- I attempted to create a plugin for
MagentoFrameworkSearchAdapterMysqlQueryBuilderMatch
, but it seems like I’m unable to find this class. 🤖🔍 - I’ve also explored some GitHub and Magento StackExchange threads for insights
Additional Context:
- Magento Version: 2.4.5-p1
- Search Engine: Elasticsearch 7
- Additional Search Module : MGS/InstantSearch
- No relevant errors in log files.
Questions:
- 🤔 Is there a configuration or best practice approach to achieve partial match searches for SKU (and potentially other attributes) in Magento 2?
- 🛠️ If customization is required, could you provide a guideline on how to approach this, especially considering the Elasticsearch engine?
Any insights, advice, or shared experiences would be incredibly helpful! 🙏🚀
Thank you in advance for your time and expertise! 🌟🛍️