id, and a relation follows that pointer in one of two directions.
- Documents that point at the judged document (many to one). An account read with its tickets and invoices, a user with their posts, a conversation with its messages. Each related document carries the judged document’s id.
- The document the judged document points at (one to many when it changes). An order line read with its product, a message with its conversation. The judged document carries the id of its referenced document, and many judged documents can share one.
Both directions share the rest:
- A relation is a key under
relatedin the judgment’s context recipe, withmatchto pick the documents it reads andfields,aggregateor both to say what the engine sees. A judgment has at most 4. - Each attribute that relations join on needs a reference index, built by a
reference_indexjob when a judgment first uses it. A namespace has at most 3, and an attribute used in both directions is one index. - An answer carries a
watermark, the log position its context was read at, and its evaluation listsrelated_documents: every document the context read, with its revision. - A write to another document that changes nothing a relation shows re-judges nothing and is not billed.
- Related documents live in the same namespace as the judged document.
entities.