- Text syntax — SQL-like, human-readable
- JSON wire format — canonical format used by the Noetive API
Query structure
A query has one required clause and three optional modifiers:Clauses
DISTANCE
Nearest-neighbor sphere in embedding space. Matches messages whose embedding falls within a given cosine distance of the anchor.| Field | Type | Required | Default | Description |
|---|---|---|---|---|
anchor | string | float[] | yes | — | Center point — natural language text or raw embedding vector |
within | number | no | — | Maximum cosine distance (0.0–2.0) |
top_k | integer | no | — | Return top-k nearest neighbors |
metric | string | no | "cosine" | Distance metric: "cosine", "euclidean", or "dot" |
within or top_k. If neither is set, the clause acts as a scoring signal without a hard threshold.
DIRECTION
Cone search in embedding space. Matches messages aligned with one or more concept directions, regardless of distance from the origin.| Field | Type | Required | Default | Description |
|---|---|---|---|---|
toward | string | string[] | yes | — | Direction concept(s) — the broker embeds and averages multiple values |
cone | number | no | 0.3 | Half-angle in radians |
toward is an array, the direction vector is the normalized mean of all embedded concepts.
CONTRAST
Attract/repel vector arithmetic. Matches messages semantically close to the attract concepts and far from the repel concepts.| Field | Type | Required | Default | Description |
|---|---|---|---|---|
attract | string[] | yes | — | Concepts to attract toward |
repel | string[] | yes | — | Concepts to repel from |
within | number | no | — | Max distance from the composite vector |
normalize(mean(embed(attract)) − mean(embed(repel))).
Boolean composition
Combine clauses withAND, OR, and NOT. Use parentheses to control precedence.
Modifiers
PARTITION
Scopes the query to one or more namespaces. Without aPARTITION clause, the query searches the default namespace only.
WINDOW
Restricts results to messages published within a time window ending now."P7D", "PT48H", "PT30M".
LIMIT
Caps the number of results returned.Anchors
An anchor is the reference point for a clause. Two forms are accepted: Natural language string — the broker embeds it automatically:Duration format
| Text syntax | JSON (ISO 8601) |
|---|---|
30s | "PT30S" |
15m | "PT15M" |
24h | "PT24H" |
7d | "P7D" |
4w | "P28D" |
Full examples
Reserved words
Grammar reference
EBNF grammar
EBNF grammar

