we are using Elasticsearch for magento 2 . We also use exact match. When typing in a product number, you are directly redirected to the product group that the product is in.
Now we want to create so called virtual product groups.
- There is the original product group containing the product with the product number 1610.001. If you type this number in and push enter, you get redirected to the main product group
- If we create a second product group that contains the product with the number 1610.001, exact match is of course not working anymore, since two product groups with that product can be found. Elasticsearch doesnt know which one is the "primary" Product group
What we want to achieve:
If we type in 1610.001, we only want to show the original product group and redirect to the original product group
But if we type in the name of the second product group or the second product group number (prodcut group number is not a product number of an article, its the number of the product group itself), the result should be shown in search also
Can you tell me how to solve this problem?
Thanks in advance!
I can't tell if you're using Enterprise Search's App Search or you've written a search integration directly with Elasticsearch. Let me know and I can re-route this post accordingly.
To attempt to generically answer your question: it sounds like you want a search experience that gives priority to matches on the original product group field, allowing for a possible redirect directly to the matching result. But if only secondary product group field matches exist, the search experience should display all matches as search results.
I think I would recommend against a search experience that attempts to detect when the searching user wants to navigate directly to a single result rather than displaying all matching results. A common alternative approach is to introduce search preview. As the user types in the search box, show them a small list of results that match their current string (perhaps even giving more weight to the original product group field!). If they select one of those preview results, navigate them directly to that result. Otherwise, if they submit their search, show them a result page containing all search results, which you can still weight by field priority.
For what it's worth App Search supports this behavior quite well.
I hope that helps!