Skip to main content
Build filters using the type-safe filter DSL:

Filter operators

Date, geo, and other operators without helpers

The DSL has no helper functions for the date operators (after, before, inLast), the geo operators (geoRadius, geoBoundingBox, geoPolygon), or doesNotBeginWith and doesNotEndWith. The Layers API still supports them. To use one, pass a plain filter group object as filterGroup. The SDK sends it to the API unchanged:
See Filtering for each operator’s values, and Geospatial filtering for the geo operators.

Filter types

The DSL produces FilterGroup and FilterExpression objects. You typically do not construct these manually, but the types are exported if you need to build filters programmatically:
The filter() function wraps a single expression in a FilterGroup automatically, so you can pass either an expression or a group:

Runtime facet discovery

In v3, available facets and their counts are fetched at runtime using sdk.facets(). sdk.facets() replaces the facets array that was passed to createClient() in v2.
You can also request filtered facet counts by passing the same filterGroup the shopper has selected:

Filter shorthand

If a single expression is all you need, pass it directly to filter(). It is equivalent to and(...) for one expression.

Next steps