You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Currently, all queries implementing the PaginatedList interface and using the ListQueryBuilder get filtering capabilities automatically.
It is possible to specify multiple properties to filter by, and then specify a boolean AND or OR operator across all the filters.
The logic I want to express is "return all variants where the $searchTerm appears in the name or the sku, AND the productId equals $productId.
Describe the solution you'd like
We need to extend the PaginatedList input object to be able to have this kind of grouped boolean logic.
This extension should be done in a backward-compatible way, because the existing API is perfectly fine for ~90% of use-cases, and quite intuitive in its simplicity.
Prior Art
We have addressed something similar in the SearchInput where we allow such groupings when filtering by facet value id.
Here's how it looks:
The facetValueFilters input can be used to specify multiple filters, combining each with either and or or.
For example, to filter by both the "Camera" and "Nikkon" facet values, we would use:
The Directus approach is certainly more powerful, and reminds me of the Elasticsearch API. It seems like Directus supports arbitrary levels of sub-nesting. Not sure we'd need that - depends on the complexity of the implementation.
I will investigate what it would take to implement something like this.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
Currently, all queries implementing the
PaginatedList
interface and using theListQueryBuilder
get filtering capabilities automatically.It is possible to specify multiple properties to filter by, and then specify a boolean
AND
orOR
operator across all the filters.For example:
This query will return all product variant where the name contains "foo" or the sku contains "123".
We could then set
filterOperator: AND
to get only those variants where both filters are true.This is pretty flexible but there are a class of queries which are simply not possible with the global filterOperator approach.
A real-world query I want to be able to do, and currently cannot, is to be able to search through variants of a given product:
The logic I want to express is "return all variants where the
$searchTerm
appears in the name or the sku, AND the productId equals$productId
.Describe the solution you'd like
We need to extend the PaginatedList input object to be able to have this kind of grouped boolean logic.
This extension should be done in a backward-compatible way, because the existing API is perfectly fine for ~90% of use-cases, and quite intuitive in its simplicity.
Prior Art
We have addressed something similar in the
SearchInput
where we allow such groupings when filtering by facet value id.Here's how it looks:
The facetValueFilters input can be used to specify multiple filters, combining each with either and or or.
For example, to filter by both the "Camera" and "Nikkon" facet values, we would use:
To filter by "Nikkon" or "Sony", we would use:
Directus support a tree-like operator structure which allows complex nesting:
The Directus approach is certainly more powerful, and reminds me of the Elasticsearch API. It seems like Directus supports arbitrary levels of sub-nesting. Not sure we'd need that - depends on the complexity of the implementation.
I will investigate what it would take to implement something like this.
The text was updated successfully, but these errors were encountered: