← Back to Stormify Documentation

Facet

class Facet

A facet is a named, user-facing filter/sort slot exposed by a PagedList or PagedQuery. It is the only point of interaction between the outside world and the underlying query — the facet's alias is the opaque public identifier, and SQL paths / expressions behind it are kept internal.

A facet can reference one or more entity field paths (OR-combined during filtering) or a raw SQL expression. Filtering between different facets uses AND logic; filtering between multiple fields on the same facet uses OR.

Facets are defined at setup time via PagedList.addFacet / PagedList.addSqlFacet (or their PagedQuery equivalents). After setup, UI consumers toggle filter / sort per facet; REST consumers pass the same information through PageSpec by alias.

Types

Link copied to clipboard
object Companion

Exposes facet Type and SortState constants as short aliases (e.g. Facet.TEXT, Facet.ASCENDING).

Link copied to clipboard

The type of facet, which determines how filter values are interpreted and converted to SQL conditions.

Properties

Link copied to clipboard

Opaque, stable identifier for this facet — the only identity exposed to the outside world. Used as the key in PagedList.saveState / PagedList.restoreState output and (in the stateless REST façade) as the key in filter / sort maps on the wire.

Link copied to clipboard

Custom converter for this facet's filter. When null (the default), the engine uses its built-in converter for the facet's type (e.g., boolean text query with LIKE for Type.TEXT, comparison parsing for Type.NUMERIC, …).

Link copied to clipboard

The current filter value, or null if no filter is active.

Link copied to clipboard

Parser that transforms user input before it reaches the database. Used for locale-aware parsing of numbers, dates, etc.

Link copied to clipboard

Whether the filter is case-sensitive. Only relevant for Type.TEXT facets. Default is false (case-insensitive).

Link copied to clipboard

Whether this facet accepts a filter. When false, attempting to set filter throws. Defaults to true.

Link copied to clipboard

Whether this facet accepts a sort direction. When false, attempting to set sort throws. Defaults to true.

Link copied to clipboard

The current sort state, or null if this facet is not sorted.

Functions

Link copied to clipboard

Clears the filter on this facet.

Link copied to clipboard
fun clearSort()

Clears sorting on this facet.

Link copied to clipboard

Returns the distinct values available for this facet, filtered by the active filters of other facets and the list constraints.