# pub.techne.draft.query

> A query over indexed records, as data: sent inline to pub.techne.draft.query.listRecords or countRecords, or published as a record in an app's own repo and run by its URI, so what an app reads is public. The platform runs it only over what the caller may read: every query is scoped to the viewer by the platform (public records not hidden; permissioned records the caller's own, or in a space whose read policy admits the caller now and not an act the reach limit withholds for its author: a held share or circle add), so there is no operator for access. Values that start with `$` are parameters: `$viewer` (the caller: compared with a DID, it matches any DID of the caller's person now, every account linked with the signed-in one, or only the signed-in DID while a sign-in method of one of them is frozen) and `$now` (the instant of the call) are filled by the platform, any other the caller passes in `params`; a published query is a template. Each record type declares which of its fields fill the shared roles in its `{collection}.query` document; a type with none is still listable by the roles every record has (`type`, `author`, `space`, `subject`, `written`, `uri`). Before running, the platform checks that every top-level `any` branch is driven by an index and refuses, naming the branch, if not. A feed is a query plus the signals it asks for plus its `weights`, which only the client applies. Draft tier.

- Kind: record
- Record key: any
- Authority: draft.techne.pub
- Lexicon: 1
- Published by [lexicons.techne.town](https://lexicon.garden/identity/did:plc:cbtfheqpi4g6vlrha4tpoh53), the NSID's authority

## Links

- [Documentation](https://lexicon.garden/lexicon/did:plc:cbtfheqpi4g6vlrha4tpoh53/pub.techne.draft.query)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:cbtfheqpi4g6vlrha4tpoh53/pub.techne.draft.query/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:cbtfheqpi4g6vlrha4tpoh53/pub.techne.draft.query/analytics)

## Record (`pub.techne.draft.query`)

Type: record · key any

### Properties

- `any` (array): Branches, each naming its own view, for a list that reads curated records of one kind and records as written of another in one request (a feed of curated events and beacons). A record that matches two branches comes once. Instead of `where` and `view`.
  - Constraints: minLength: 1, maxLength: 8
  - `items` (ref)
    - Reference: `#branch`
- `createdAt` (string · datetime)
- `curated` (boolean): Deprecated: `view` replaced it. It has no default. Accepted beside `view` only when it agrees (true with `curated`, false with `asWritten`); alone, it is refused like a missing view, except from Beacon builds from before views through 2027-03-01, where true or absent reads unscoped branches curated and false reads every branch as written.
- `held` (boolean): Only the signed-in caller's own permissioned records that the reach limit holds back from the people they would reach (each marked `held`; a held act, a share or a circle add, is answered to its author alone). No public record answers; an anonymous caller gets none.
  - Constraints: default: false
- `limit` (integer): The page size when the call names none.
  - Constraints: minimum: 1, maximum: 500, default: 50
- `order` (string): Exactly one thing to order by: a role (`written`, newest first; `start` or `end`, soonest first), a measure named by `as` (a `near` distance, nearest first; a `matches` rank, best first), or `shuffle` (one deterministic order per `seed`: the same seed answers the same order on every call and across pages; a shuffle sorts all its query matches, so every branch must be driven at its top by a `near` or by an author, space, subject, URI or reference with `is`/`in`). Ties break on the record URI. Default `written`. Ordering by a role lists only records that have it; a measure orders only a query with one branch (two branches could give one record two numbers).
  - Constraints: maxLength: 64
- `seed` (string): The seed of `order: shuffle`, a literal or a parameter (`$seed`); required with it and refused without it.
  - Constraints: minLength: 1, maxLength: 256
- `signals` (array): Numbers the platform attaches to each result from data the client does not have. They never filter.
  - Constraints: maxLength: 8
  - `items` (ref)
    - Reference: `#signal`
- `view` (string): Which public records the branches of `where` read: `curated` (the commons' listed records: one curated record per thing, merged from its sources by a curator the commons root trusts, moderated, not hidden; an event only inside the supported areas) or `asWritten` (every public record as its author wrote it: each source copy and the curated record, not hidden, not superseded). Required with `where`, never beside `any` (each branch names its own there): there is no default. `curated` on a branch whose `type` names a type no curator covers is refused with NotCurated, naming the type. A permissioned record is read the same way in both views (it is never curated). Beacon builds from before views, which name none, are answered with the old default through 2027-03-01 (the last day).
  - Constraints: maxLength: 16, knownValues: curated | asWritten
- `weights` (array): For a feed: how the client combines measures and signals into one rank. The platform never reads them.
  - Constraints: maxLength: 16
  - `items` (ref)
    - Reference: `#weight`
- `where` (ref): What to select; with `view`. Give `where` or `any`, not both.
  - Reference: `#node`

## #branch (`pub.techne.draft.query#branch`)

Type: object

One branch of a query's `any`: its view and what it selects. A `where` whose top is itself an `any` makes one branch of each child, all in this view.

### Properties

- `view` (string, required): This branch's view: as the query's `view`.
  - Constraints: maxLength: 16, knownValues: curated | asWritten
- `where` (ref, required)
  - Reference: `#node`

## #closeness (`pub.techne.draft.query#closeness`)

Type: object

Graph hops from `from` (only `$viewer` today) to the result's author over the viewer-scoped graph walk: 0 for the viewer's own records (any DID of the viewer's person now); absent when the walk does not reach the author, and for an anonymous caller.

### Properties

- `from` (string, required)
  - Constraints: maxLength: 64

## #condition (`pub.techne.draft.query#condition`)

Type: object

One operator and its value. A string value starting with `$` is a parameter.

### Properties

- `after` (string): An RFC-3339 instant, or a parameter (`$now`); strictly after.
  - Constraints: maxLength: 64
- `as` (string): The name of the number an operator produces (`near`: metres away; `matches`: rank), in letters, digits, `.`, `_` and `-`. Default `<role>.<operator>`.
  - Constraints: maxLength: 64
- `before` (string): An RFC-3339 instant, or a parameter (`$now`); strictly before.
  - Constraints: maxLength: 64
- `covers` (string): On `location`: a point (`<latitude>,<longitude>`, an H3 cell, or a `$param`) that a stated area contains.
  - Constraints: maxLength: 64
- `followed` (boolean): With `in` or `covers`: also match a record through the subject its type declares (a receipt through its recipient), one hop.
- `in` (array): Any of these values; each is a value or a `$param` (a param holding a list adds all its values). On `location`: the areas (at most 8).
  - Constraints: maxLength: 100
  - `items` (string)
    - Constraints: maxLength: 2048
- `is` (string)
  - Constraints: maxLength: 2048
- `kind` (string): With `in` or `covers`: the kind of stated location to match (`serves`, `registered`, ...). Default `at` (is at).
  - Constraints: maxLength: 64
- `matches` (string): Words the text must hold (all of them); the last word may be the start of a word, as typed so far. Produces a rank, best first.
  - Constraints: maxLength: 256
- `near` (ref)
  - Reference: `#near`

## #has (`pub.techne.draft.query#has`)

Type: object

`has`: some public record the caller may read (not hidden, not a hidden or suspended account's, not across a block) names this record through the role `via`, by this record's own author when `by` is `author`, and matches `where`. One index probe per record the branch reads; it narrows a branch and never drives one. It counts as one condition, plus one for each leaf in `where`. A `has` inside a `has` is refused.

### Properties

- `by` (string): `author`: only a record in this record's own author's repo. Any other value is refused.
  - Constraints: maxLength: 16, knownValues: author
- `via` (string, required): The other record's role that holds this record's AT-URI: a URI role every record has other than its own `uri` (today only `subject`).
  - Constraints: maxLength: 64
- `where` (ref): What the other record also matches: `type` and/or `author` conditions (`is` or `in`), one alone or several under one `all`.
  - Reference: `#node`

## #near (`pub.techne.draft.query#near`)

Type: object

### Properties

- `point` (string, required): `<latitude>,<longitude>` in degrees, or an H3 cell index of any resolution (its centre is the point), or a parameter (`$here`).
  - Constraints: maxLength: 64
- `within` (string, required): A radius such as `100m` or `5km`, at most 50km.
  - Constraints: maxLength: 16

## #node (`pub.techne.draft.query#node`)

Type: object

One node of the `where` tree: exactly one property. `all` (every child holds), `any` (at least one holds; at the top level each child is a branch the platform runs on its own index), `not` (a list of one node that must not hold; it narrows and never drives a branch), `has` (some other record names this one; it narrows and never drives a branch), or a leaf naming one role with one condition. A leaf that produces a number (`near`, `matches`) is allowed only at the top of a branch.

### Properties

- `all` (array)
  - Constraints: maxLength: 16
  - `items` (ref)
    - Reference: `#node`
- `any` (array)
  - Constraints: maxLength: 8
  - `items` (ref)
    - Reference: `#node`
- `author` (ref): The DID whose repo holds the record. Operators: is, in.
  - Reference: `#condition`
- `category` (ref): The record's category, one exact token (declared per type; a place's Overture `categories.primary`, e.g. `park`). Compared whole, never as a substring. Operators: is, in. It narrows a branch and never drives one.
  - Reference: `#condition`
- `end` (ref): When it ends (declared per type; a type may assume a duration when the end is not stated, and then a start at a midnight in its own stated offset, never the reader's zone, runs at least to the next midnight in that offset, a day). Operators: before, after.
  - Reference: `#condition`
- `has` (ref): Some public record the caller may read names this one through the role `via`. Under `not`, none does (an anti-join).
  - Reference: `#has`
- `location` (ref): Where it is. Operators: near (declared per type: a point or cell within a radius, never an area); in (a list of up to 8 areas, each the AT-URI of an area record (a type whose query document declares `extent`; placeV2 today) or a `$param`: a stated location whose centre lies in one of them); covers (a point: an area the record states, such as one it serves, that contains the point). in and covers read every stated location (any type with a location or a subject), take `kind` and `followed`, are allowed only at the top of a branch, and give each record `matched`, the locations that matched (entry, kind, asserter, source; at most 8). They match public records only: the index they read holds public records, so a permissioned record never matches them (near does). In the curated view only the author's own locations and claims by writers the commons root endorses count, with the precedence rerun over them; as written every claim is weighed. A read whose `near` or `covers` point or `in` area lies outside this operator's coverage, or names an area not held here, is answered with `notServedHere`.
  - Reference: `#condition`
- `not` (array): One node that must not hold.
  - Constraints: minLength: 1, maxLength: 1
  - `items` (ref)
    - Reference: `#node`
- `references` (ref): AT-URIs it names in the fields its type declares, which may include its subject; a DID is named as its repo AT-URI `at://{did}`. Operators: is (names this one), in (names any of these).
  - Reference: `#condition`
- `space` (ref): The space a permissioned record counts in (at://{authority}/{spaceType}/{skey}); a public record is in none. Operators: is, in.
  - Reference: `#condition`
- `start` (ref): When the thing the record describes begins (declared per type). Operators: before, after.
  - Reference: `#condition`
- `subject` (ref): The record the record is about (its indexed subject). Operators: is, in.
  - Reference: `#condition`
- `text` (ref): Its words (declared per type). Operator: matches.
  - Reference: `#condition`
- `type` (ref): The record's collection NSID. Operators: is, in.
  - Reference: `#condition`
- `uri` (ref): The record's own AT-URI. Operators: is, in.
  - Reference: `#condition`
- `written` (ref): When the record was indexed. Operators: before, after.
  - Reference: `#condition`

## #roles (`pub.techne.draft.query#roles`)

Type: queryRoleCatalog

The shared roles, as data: what each role is, the operators it takes, the index column that drives it, and the order it lists in. Kinds: `nsid`, `did`, `space`, `uri`, `uris` (a list of AT-URIs), `micros`, `instant`, `location`, `text`, and `token` (one exact string, compared whole: never a substring). `every` roles are on every record; the others are filled per type by its `{collection}.query` document. A new role is one generic column and its index, added once for every type, and goes through review like a new space policy.

## #signal (`pub.techne.draft.query#signal`)

Type: object

One server-side signal: exactly one kind, and the name it is attached under.

### Properties

- `as` (string): Default: the signal's kind.
  - Constraints: maxLength: 64
- `closeness` (ref)
  - Reference: `#closeness`

## #weight (`pub.techne.draft.query#weight`)

Type: object

### Properties

- `name` (string, required): A measure or signal name.
  - Constraints: maxLength: 64
- `weight` (string, required): A decimal, as a string.
  - Constraints: maxLength: 32

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "branch": {
      "description": "One branch of a query's `any`: its view and what it selects. A `where` whose top is itself an `any` makes one branch of each child, all in this view.",
      "properties": {
        "view": {
          "description": "This branch's view: as the query's `view`.",
          "knownValues": [
            "curated",
            "asWritten"
          ],
          "maxLength": 16,
          "type": "string"
        },
        "where": {
          "ref": "#node",
          "type": "ref"
        }
      },
      "required": [
        "view",
        "where"
      ],
      "type": "object"
    },
    "closeness": {
      "description": "Graph hops from `from` (only `$viewer` today) to the result's author over the viewer-scoped graph walk: 0 for the viewer's own records (any DID of the viewer's person now); absent when the walk does not reach the author, and for an anonymous caller.",
      "properties": {
        "from": {
          "maxLength": 64,
          "type": "string"
        }
      },
      "required": [
        "from"
      ],
      "type": "object"
    },
    "condition": {
      "description": "One operator and its value. A string value starting with `$` is a parameter.",
      "properties": {
        "after": {
          "description": "An RFC-3339 instant, or a parameter (`$now`); strictly after.",
          "maxLength": 64,
          "type": "string"
        },
        "as": {
          "description": "The name of the number an operator produces (`near`: metres away; `matches`: rank), in letters, digits, `.`, `_` and `-`. Default `<role>.<operator>`.",
          "maxLength": 64,
          "type": "string"
        },
        "before": {
          "description": "An RFC-3339 instant, or a parameter (`$now`); strictly before.",
          "maxLength": 64,
          "type": "string"
        },
        "covers": {
          "description": "On `location`: a point (`<latitude>,<longitude>`, an H3 cell, or a `$param`) that a stated area contains.",
          "maxLength": 64,
          "type": "string"
        },
        "followed": {
          "description": "With `in` or `covers`: also match a record through the subject its type declares (a receipt through its recipient), one hop.",
          "type": "boolean"
        },
        "in": {
          "description": "Any of these values; each is a value or a `$param` (a param holding a list adds all its values). On `location`: the areas (at most 8).",
          "items": {
            "maxLength": 2048,
            "type": "string"
          },
          "maxLength": 100,
          "type": "array"
        },
        "is": {
          "maxLength": 2048,
          "type": "string"
        },
        "kind": {
          "description": "With `in` or `covers`: the kind of stated location to match (`serves`, `registered`, ...). Default `at` (is at).",
          "maxLength": 64,
          "type": "string"
        },
        "matches": {
          "description": "Words the text must hold (all of them); the last word may be the start of a word, as typed so far. Produces a rank, best first.",
          "maxLength": 256,
          "type": "string"
        },
        "near": {
          "ref": "#near",
          "type": "ref"
        }
      },
      "type": "object"
    },
    "has": {
      "description": "`has`: some public record the caller may read (not hidden, not a hidden or suspended account's, not across a block) names this record through the role `via`, by this record's own author when `by` is `author`, and matches `where`. One index probe per record the branch reads; it narrows a branch and never drives one. It counts as one condition, plus one for each leaf in `where`. A `has` inside a `has` is refused.",
      "properties": {
        "by": {
          "description": "`author`: only a record in this record's own author's repo. Any other value is refused.",
          "knownValues": [
            "author"
          ],
          "maxLength": 16,
          "type": "string"
        },
        "via": {
          "description": "The other record's role that holds this record's AT-URI: a URI role every record has other than its own `uri` (today only `subject`).",
          "maxLength": 64,
          "type": "string"
        },
        "where": {
          "description": "What the other record also matches: `type` and/or `author` conditions (`is` or `in`), one alone or several under one `all`.",
          "ref": "#node",
          "type": "ref"
        }
      },
      "required": [
        "via"
      ],
      "type": "object"
    },
    "main": {
      "key": "any",
      "record": {
        "properties": {
          "any": {
            "description": "Branches, each naming its own view, for a list that reads curated records of one kind and records as written of another in one request (a feed of curated events and beacons). A record that matches two branches comes once. Instead of `where` and `view`.",
            "items": {
              "ref": "#branch",
              "type": "ref"
            },
            "maxLength": 8,
            "minLength": 1,
            "type": "array"
          },
          "createdAt": {
            "format": "datetime",
            "type": "string"
          },
          "curated": {
            "description": "Deprecated: `view` replaced it. It has no default. Accepted beside `view` only when it agrees (true with `curated`, false with `asWritten`); alone, it is refused like a missing view, except from Beacon builds from before views through 2027-03-01, where true or absent reads unscoped branches curated and false reads every branch as written.",
            "type": "boolean"
          },
          "held": {
            "default": false,
            "description": "Only the signed-in caller's own permissioned records that the reach limit holds back from the people they would reach (each marked `held`; a held act, a share or a circle add, is answered to its author alone). No public record answers; an anonymous caller gets none.",
            "type": "boolean"
          },
          "limit": {
            "default": 50,
            "description": "The page size when the call names none.",
            "maximum": 500,
            "minimum": 1,
            "type": "integer"
          },
          "order": {
            "description": "Exactly one thing to order by: a role (`written`, newest first; `start` or `end`, soonest first), a measure named by `as` (a `near` distance, nearest first; a `matches` rank, best first), or `shuffle` (one deterministic order per `seed`: the same seed answers the same order on every call and across pages; a shuffle sorts all its query matches, so every branch must be driven at its top by a `near` or by an author, space, subject, URI or reference with `is`/`in`). Ties break on the record URI. Default `written`. Ordering by a role lists only records that have it; a measure orders only a query with one branch (two branches could give one record two numbers).",
            "maxLength": 64,
            "type": "string"
          },
          "seed": {
            "description": "The seed of `order: shuffle`, a literal or a parameter (`$seed`); required with it and refused without it.",
            "maxLength": 256,
            "minLength": 1,
            "type": "string"
          },
          "signals": {
            "description": "Numbers the platform attaches to each result from data the client does not have. They never filter.",
            "items": {
              "ref": "#signal",
              "type": "ref"
            },
            "maxLength": 8,
            "type": "array"
          },
          "view": {
            "description": "Which public records the branches of `where` read: `curated` (the commons' listed records: one curated record per thing, merged from its sources by a curator the commons root trusts, moderated, not hidden; an event only inside the supported areas) or `asWritten` (every public record as its author wrote it: each source copy and the curated record, not hidden, not superseded). Required with `where`, never beside `any` (each branch names its own there): there is no default. `curated` on a branch whose `type` names a type no curator covers is refused with NotCurated, naming the type. A permissioned record is read the same way in both views (it is never curated). Beacon builds from before views, which name none, are answered with the old default through 2027-03-01 (the last day).",
            "knownValues": [
              "curated",
              "asWritten"
            ],
            "maxLength": 16,
            "type": "string"
          },
          "weights": {
            "description": "For a feed: how the client combines measures and signals into one rank. The platform never reads them.",
            "items": {
              "ref": "#weight",
              "type": "ref"
            },
            "maxLength": 16,
            "type": "array"
          },
          "where": {
            "description": "What to select; with `view`. Give `where` or `any`, not both.",
            "ref": "#node",
            "type": "ref"
          }
        },
        "type": "object"
      },
      "type": "record"
    },
    "near": {
      "properties": {
        "point": {
          "description": "`<latitude>,<longitude>` in degrees, or an H3 cell index of any resolution (its centre is the point), or a parameter (`$here`).",
          "maxLength": 64,
          "type": "string"
        },
        "within": {
          "description": "A radius such as `100m` or `5km`, at most 50km.",
          "maxLength": 16,
          "type": "string"
        }
      },
      "required": [
        "point",
        "within"
      ],
      "type": "object"
    },
    "node": {
      "description": "One node of the `where` tree: exactly one property. `all` (every child holds), `any` (at least one holds; at the top level each child is a branch the platform runs on its own index), `not` (a list of one node that must not hold; it narrows and never drives a branch), `has` (some other record names this one; it narrows and never drives a branch), or a leaf naming one role with one condition. A leaf that produces a number (`near`, `matches`) is allowed only at the top of a branch.",
      "properties": {
        "all": {
          "items": {
            "ref": "#node",
            "type": "ref"
          },
          "maxLength": 16,
          "type": "array"
        },
        "any": {
          "items": {
            "ref": "#node",
            "type": "ref"
          },
          "maxLength": 8,
          "type": "array"
        },
        "author": {
          "description": "The DID whose repo holds the record. Operators: is, in.",
          "ref": "#condition",
          "type": "ref"
        },
        "category": {
          "description": "The record's category, one exact token (declared per type; a place's Overture `categories.primary`, e.g. `park`). Compared whole, never as a substring. Operators: is, in. It narrows a branch and never drives one.",
          "ref": "#condition",
          "type": "ref"
        },
        "end": {
          "description": "When it ends (declared per type; a type may assume a duration when the end is not stated, and then a start at a midnight in its own stated offset, never the reader's zone, runs at least to the next midnight in that offset, a day). Operators: before, after.",
          "ref": "#condition",
          "type": "ref"
        },
        "has": {
          "description": "Some public record the caller may read names this one through the role `via`. Under `not`, none does (an anti-join).",
          "ref": "#has",
          "type": "ref"
        },
        "location": {
          "description": "Where it is. Operators: near (declared per type: a point or cell within a radius, never an area); in (a list of up to 8 areas, each the AT-URI of an area record (a type whose query document declares `extent`; placeV2 today) or a `$param`: a stated location whose centre lies in one of them); covers (a point: an area the record states, such as one it serves, that contains the point). in and covers read every stated location (any type with a location or a subject), take `kind` and `followed`, are allowed only at the top of a branch, and give each record `matched`, the locations that matched (entry, kind, asserter, source; at most 8). They match public records only: the index they read holds public records, so a permissioned record never matches them (near does). In the curated view only the author's own locations and claims by writers the commons root endorses count, with the precedence rerun over them; as written every claim is weighed. A read whose `near` or `covers` point or `in` area lies outside this operator's coverage, or names an area not held here, is answered with `notServedHere`.",
          "ref": "#condition",
          "type": "ref"
        },
        "not": {
          "description": "One node that must not hold.",
          "items": {
            "ref": "#node",
            "type": "ref"
          },
          "maxLength": 1,
          "minLength": 1,
          "type": "array"
        },
        "references": {
          "description": "AT-URIs it names in the fields its type declares, which may include its subject; a DID is named as its repo AT-URI `at://{did}`. Operators: is (names this one), in (names any of these).",
          "ref": "#condition",
          "type": "ref"
        },
        "space": {
          "description": "The space a permissioned record counts in (at://{authority}/{spaceType}/{skey}); a public record is in none. Operators: is, in.",
          "ref": "#condition",
          "type": "ref"
        },
        "start": {
          "description": "When the thing the record describes begins (declared per type). Operators: before, after.",
          "ref": "#condition",
          "type": "ref"
        },
        "subject": {
          "description": "The record the record is about (its indexed subject). Operators: is, in.",
          "ref": "#condition",
          "type": "ref"
        },
        "text": {
          "description": "Its words (declared per type). Operator: matches.",
          "ref": "#condition",
          "type": "ref"
        },
        "type": {
          "description": "The record's collection NSID. Operators: is, in.",
          "ref": "#condition",
          "type": "ref"
        },
        "uri": {
          "description": "The record's own AT-URI. Operators: is, in.",
          "ref": "#condition",
          "type": "ref"
        },
        "written": {
          "description": "When the record was indexed. Operators: before, after.",
          "ref": "#condition",
          "type": "ref"
        }
      },
      "type": "object"
    },
    "roles": {
      "description": "The shared roles, as data: what each role is, the operators it takes, the index column that drives it, and the order it lists in. Kinds: `nsid`, `did`, `space`, `uri`, `uris` (a list of AT-URIs), `micros`, `instant`, `location`, `text`, and `token` (one exact string, compared whole: never a substring). `every` roles are on every record; the others are filled per type by its `{collection}.query` document. A new role is one generic column and its index, added once for every type, and goes through review like a new space policy.",
      "roles": {
        "author": {
          "column": "did",
          "every": true,
          "kind": "did",
          "operators": [
            "is",
            "in"
          ]
        },
        "category": {
          "column": "category",
          "kind": "token",
          "operators": [
            "is",
            "in"
          ]
        },
        "end": {
          "column": "ends_at",
          "kind": "instant",
          "operators": [
            "before",
            "after"
          ],
          "order": "asc"
        },
        "location": {
          "column": "h3_r5",
          "kind": "location",
          "operators": [
            "near",
            "in",
            "covers"
          ]
        },
        "references": {
          "column": "refs",
          "kind": "uris",
          "operators": [
            "is",
            "in"
          ]
        },
        "space": {
          "column": "space_uri",
          "every": true,
          "kind": "space",
          "operators": [
            "is",
            "in"
          ]
        },
        "start": {
          "column": "starts_at",
          "kind": "instant",
          "operators": [
            "before",
            "after"
          ],
          "order": "asc"
        },
        "subject": {
          "column": "subject_uri",
          "every": true,
          "kind": "uri",
          "operators": [
            "is",
            "in"
          ]
        },
        "text": {
          "column": "search_text",
          "kind": "text",
          "operators": [
            "matches"
          ]
        },
        "type": {
          "column": "collection",
          "every": true,
          "kind": "nsid",
          "operators": [
            "is",
            "in"
          ]
        },
        "uri": {
          "column": "at_uri",
          "every": true,
          "kind": "uri",
          "operators": [
            "is",
            "in"
          ]
        },
        "written": {
          "column": "time_us",
          "every": true,
          "kind": "micros",
          "operators": [
            "before",
            "after"
          ],
          "order": "desc"
        }
      },
      "type": "queryRoleCatalog"
    },
    "signal": {
      "description": "One server-side signal: exactly one kind, and the name it is attached under.",
      "properties": {
        "as": {
          "description": "Default: the signal's kind.",
          "maxLength": 64,
          "type": "string"
        },
        "closeness": {
          "ref": "#closeness",
          "type": "ref"
        }
      },
      "type": "object"
    },
    "weight": {
      "properties": {
        "name": {
          "description": "A measure or signal name.",
          "maxLength": 64,
          "type": "string"
        },
        "weight": {
          "description": "A decimal, as a string.",
          "maxLength": 32,
          "type": "string"
        }
      },
      "required": [
        "name",
        "weight"
      ],
      "type": "object"
    }
  },
  "description": "A query over indexed records, as data: sent inline to pub.techne.draft.query.listRecords or countRecords, or published as a record in an app's own repo and run by its URI, so what an app reads is public. The platform runs it only over what the caller may read: every query is scoped to the viewer by the platform (public records not hidden; permissioned records the caller's own, or in a space whose read policy admits the caller now and not an act the reach limit withholds for its author: a held share or circle add), so there is no operator for access. Values that start with `$` are parameters: `$viewer` (the caller: compared with a DID, it matches any DID of the caller's person now, every account linked with the signed-in one, or only the signed-in DID while a sign-in method of one of them is frozen) and `$now` (the instant of the call) are filled by the platform, any other the caller passes in `params`; a published query is a template. Each record type declares which of its fields fill the shared roles in its `{collection}.query` document; a type with none is still listable by the roles every record has (`type`, `author`, `space`, `subject`, `written`, `uri`). Before running, the platform checks that every top-level `any` branch is driven by an index and refuses, naming the branch, if not. A feed is a query plus the signals it asks for plus its `weights`, which only the client applies. Draft tier.",
  "id": "pub.techne.draft.query",
  "lexicon": 1
}
```
