Skip to main content

Module query

Module query 

Source

Structs§

AggCall
One aggregate in an Aggregate. field is None only for Count, and arg is the fraction for Percentile (e.g. 0.95). alias is the output header key on each result row.
Aggregate
A grouped aggregation carrying one or more AggCalls, so a single query can return several aggregates grouped by the same keys. An optional window adds a time-bucket key.
ConsistencyGate
The server-side gate that enforces a Consistency level the same way on every backend. The client refuses an unadvertised level before sending, but a backend that does advertise read_your_writes or strong_consistency still has to honor the level, and the rule is fail-not-downgrade: serve only when the projector’s applied offset for the queried source has reached the required offset (the source log head at query time), else return QueryError::Stale rather than a silently older read.
KeyMatch
One exact-match constraint: the indexed field must equal value.
Page
Pagination info for a query result.
Predicate
A filter leaf: a field, a comparison op, and a value.
Query
A query against a materialized index. Build it fluently via the SDK’s Laser::query, or directly through Query::builder.
QueryBuilder
Use builder syntax to set the inputs and finish with build().
QueryEnvelope
Internal on-wire envelope: a versioned wrapper around Query. Workers and clients use it, app code does not.
QueryResult
A page of result rows plus pagination info.
RawSql
Raw-SQL escape hatch. sql must be a single read-only SELECT. params bind positionally. SQL backends only.
Row
One materialized row: indexed fields, metadata, log position, and optional payload/score.
Select
Which columns and payload a query returns.
Sort
An order-by clause: a field and a direction.
TextQuery
A lexical relevance search: the text to match and, optionally, the one indexed field to match it in (None searches every text-hinted field). Relevance lands in the reply’s Row.score slot exactly as vector distance does, so the reply shape never changes. Capability-gated by KEYWORD_SEARCH: a backend without a lexical index answers unsupported, never a contains approximation.
VectorQuery
A nearest-neighbour search: the query embedding and how many rows to return.
Window
A tumbling window of every_micros over the timestamp field.

Enums§

AggFunc
An aggregate function. Percentile and StdDev are backend-gated (the embedded engine does not provide them, a columnar backend does).
CmpOp
A comparison operator for a Predicate.
Consistency
How fresh a query’s view of the materialized index must be. A materialized view is a read model a projector builds by tailing the log, so it is eventually consistent: a record is queryable once the projector has applied it, not the instant it is appended. This level says what the query requires of that lag, and the contract is fail-not-downgrade: a level that cannot be met returns QueryError::Stale rather than silently serving older data.
Dir
Sort direction (ascending or descending).
Filter
A predicate tree. All/Any are n-ary, Not negates, Pred is a single comparison leaf. Externally tagged on the wire: {"all":[{"pred":{...}}]}.
QueryError
Why a query failed.
QueryReply
A query reply: Ok(QueryResult) or Err(QueryError).
Value
A scalar value in a predicate or result row. #[serde(untagged)], riding the wire as a bare scalar. Variant order matters for untagged decode: Int before Uint keeps small/negative integers as i64, and a value past i64::MAX falls through to Uint before Float (never a lossy f64). Null is a unit variant matching a bare null.