-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Describe the bug
Advanced filtering in PagenatedList queries does not return any items as soon as the same attribute is filtered by more than once.
The most common use case is probably filtering by facetValueId (which strangely also is available on the shop API, but that's another topic). But using it twice within a _and or _or operator leads to no results. It does work as expected in the search query but imo the provided filter on the products query should work as you would it expect it to.
To Reproduce
Steps to reproduce the behavior:
- Setup a vanilla Vendure installation with the provided sample data.
- Run the following query on the admin API:
query Products {
products(options: {
filter: {
_and: [
{
facetValueId: {
eq: "34"
}
}
]
}
}) {
totalItems
items {
name
}
}
}- This should return 11 items
- Now add a second facetValue to the filter:
query Products {
products(options: {
filter: {
_and: [
{
facetValueId: {
eq: "34"
}
},
{
facetValueId: {
eq: "37"
}
}
]
}
}) {
totalItems
items {
name
}
}
}- No items are returned even though there are products matching both facetValues
Expected behavior
The latter query should return 2 items.
Environment (please complete the following information):
- @vendure/core version: 3.1.0
- Nodejs version: 20.11.0
- Database (mysql/postgres etc): postgres
Additional context
This can be recreated in the admin-ui by filtering by facet values Category:Furniture (34) and Color:Wood (37). It works in the admin ui because here two subsequent requests are made instead of one with both facetValues.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status