I would like to search in Shop GQL with many facetValueIds of the same facet. For example:
(These prints are from my shop)
Here we have all products

Here just "Apple" products

Here just "Samsung" products

And here should show both "Apple" and "Samsung" products

Here the query behind the last print:
query SearchProducts {
search(input: {
take: 5
collectionId: "2"
groupByProduct: true
facetValueIds: [ "5", "3"]
}) {
totalItems
items {
productId
productName
facetValueIds
}
}
}
I think the way it is working now is not right in any situation. Maybe a solution its change the default search strategy. I'm not a Vendure expert (yet😜) but i think maybe its related to this line of code where have a loop of facetValues AND in MySQL.
Another approach its to configure in these settings in query search input as an option. But i don't think that its not necessary because i don't think that someone will search with operator AND.
Yes, I had faced the same issue yesterday, I have been meaning to comment on this feature as well. Seems like the approach jonyw4 mentioned is the common eCommerce search strategy. would love to see this feature come true.
The solution I opted for is to add a new field facetValueOperator to the SearchInput, which allows you to specify "AND" or "OR", and defaults to "OR".
Will be available in the next release!
Most helpful comment
Yes, I had faced the same issue yesterday, I have been meaning to comment on this feature as well. Seems like the approach jonyw4 mentioned is the common eCommerce search strategy. would love to see this feature come true.