Skip to main content

Module query

Module query 

Source
Expand description

The runner (spec/surface/README.md §1.4): parse the source, rewrite the row functions to $self methods, run it through the engine over the store context, and shape the engine’s result into the surface’s OqxResult (lean { id, path, … } hits, keyset paging, the consumer scalars). Port of packages/core/src/oqx-js/run.ts.

By default the tier-3 planner (crate::planner) pre-filters the scan in SQL and the in-memory engine finishes the residual over the produced rows; QueryOptions::in_memory forces the pure in-memory engine (the differential gate runs every case both ways — a planner must be invisible).

Structs§

OqxResult
§1.4 OqxResult.
QueryOptions
query’s options.

Constants§

DEFAULT_LIMIT
The default page size.
REPO_REMOVED_MESSAGE
The $repo error (removed in surface 2.0): the same text in both engines.

Functions§

bare_target_message
The bare-target error. depth is the scope depth the name was read at when known statically (the carets in the hint count it); None when raised at read time by the context, where the hint spells out the rule instead.
check_root_spellings
The repository is OQX’s root row (spec/oqx 0.18): from a top-level row ^docs reaches the documents (one caret per enclosing block, or the absolute 0^docs) and ^$id the repository id. Two spellings are refused before evaluation, by one walk over the parsed tree, so the error does not depend on which rows the data holds and the planned and in-memory paths agree trivially: $repo anywhere (bare, as a member head, ^$repo, 0^$repo), and a bare docs/edges at scope depth ≥ 1 — a property read of a row that has none. blocks/nodes are relations of some rows (docs.blocks, docs.nodes, blocks.nodes, section.blocks) and are judged by the context at read time with the same message. A ^<target> with more carets than enclosing scopes (^docs count { } at the top level) would read absent and count 0: refused too, naming the bare spelling. Port of the reference’s checkRootSpellings.
collect_semantic_phrases
The distinct phrases semantic("…") names (free calls in the raw parse); empty when the source does not parse.
past_root_message
The past-the-root error: ^docs at the root scope (more carets than there are enclosing scopes) would read absent and count 0 — refused, naming the bare spelling. levels is the caret count written.
query
Run an OQX query against repo_id (§1.4).
rewrite_query
Rewrite every row function in a parsed query to a $self method call, and root every string literal compared with a path intrinsic — one transform over the AST (spec/oqx/AST.md §5), every block included.
root_path_literals
The literal-rooting rewrite of one expression (see rewrite_query).