evitaDB - Fast e-commerce database
logo
page-background

Behavioral filtering containers

Special behavioral filtering constraint containers are used only for the definition of a filter constraint scope, which has a different treatment in calculations.

User filter

filterConstraint:any+

one or more mandatory filter constraints that will produce logical conjunction

The
works identically to the and constraint, but it distinguishes the filter scope, which is controlled by the user through some kind of user interface, from the rest of the query, which contains the mandatory constraints on the result set. The user-defined scope can be modified during certain calculations (such as the facet or histogram calculation), while the mandatory part outside of userFilter cannot.
Let's look at the example where the facetHaving constraint is used inside the userFilter container:
And compare it to the situation when we remove the userFilter container:
Facet summary with facetHaving in userFilterFacet summary without userFilter scope
BeforeBeforeAfterAfter
As you can see in the second image, the facet summary is greatly reduced to a single facet option that is selected by the user. Because the facet is considered a "mandatory" constraint in this case, it behaves the same as the referenceHaving constraint, which is combined with other constraints via logical disjunction. Since there is no other entity that would refer to both the amazon brand and another brand (of course, a product can only have a single brand), the other possible options are automatically removed from the facet summary because they would produce an empty result set.

Author: Ing. Jan Novotný

Date updated: 7.11.2023

Documentation Source