I am creating a custom API endpoint for returning the filters for a particular search term. I tried following the "Magento GraphQL’s approach" and used
but the problem is that it is returning ALL the filters with all their options instead of only the ones with products in them. For example, if I search for
iphone and the possible values of the filter
6gb. But if I use this technique it’s returning the other filter values as well, like
10gb etc., clicking on which is returning 0 products.
This is not how it is working in LUMA. So my guess is that I’m doing something wrong.
So what I’m asking I guess is, how to return the proper filters array for a search term programmatically