← Back to Stormify Documentation

PageSpec

data class PageSpec @JvmOverloads constructor(val page: Int, val pageSize: Int, val filters: Map<String, String> = emptyMap(), val sorts: Map<String, SortDir> = emptyMap(), val caseSensitive: Map<String, Boolean> = emptyMap())

Per-request specification passed to PagedQuery.execute and friends. Describes the filters, sorts, case-sensitivity flags and pagination the caller wants for this single query. Keys in the map fields are facet aliases (see Facet.alias); any alias not present in the map contributes nothing to the generated SQL.

All fields are plain data so a spec can be round-tripped through any serialization framework — JSON, Parcelable, Kotlinx Serialization — and handed to the engine unchanged.

Construction

Two constructors are provided:

  • PaginatedPageSpec(page, pageSize, filters?, sorts?, cs?). Use for PagedQuery.execute / PagedQuery.filterValues where page and pageSize control which slice is returned.

  • Non-paginatedPageSpec(filters?, sorts?, cs?). Equivalent to PageSpec(0, 15, ...). Use for PagedQuery.forEachStreaming / PagedQuery.getAggregator where pagination is ignored.

Both constructors have @JvmOverloads so Java callers can omit trailing arguments in either form.

Constructors

Link copied to clipboard
constructor(page: Int, pageSize: Int, filters: Map<String, String> = emptyMap(), sorts: Map<String, SortDir> = emptyMap(), caseSensitive: Map<String, Boolean> = emptyMap())
constructor(filters: Map<String, String> = emptyMap(), sorts: Map<String, SortDir> = emptyMap(), caseSensitive: Map<String, Boolean> = emptyMap())

Non-paginated spec constructor. Delegates to the paginated form with page = 0, pageSize = 15. The pagination defaults are ignored by use cases that do not paginate (PagedQuery.forEachStreaming, PagedQuery.getAggregator); for paginated callers that accept defaults, they represent "first page, 15 rows".

Types

Link copied to clipboard
object Companion

Factory and JSON-parsing helpers for PageSpec.

Properties

Link copied to clipboard

Per-alias case-sensitivity overrides for text facets. Missing aliases default to false.

Link copied to clipboard

Per-alias filter values. Missing aliases → no filter. The configured nullToken (default "NULL") produces IS NULL.

Link copied to clipboard
val page: Int

Zero-based page index.

Link copied to clipboard

Number of rows per page. Must be at least 1.

Link copied to clipboard

Per-alias sort directions.