Skip to main content

Module filter

Module filter 

Source
Expand description

where: — the conditions a document must meet to be in a view.

Scope (under) says where a view looks; this says which of what it finds belongs. The two are separate because they fail differently: an anchor that names nothing is a broken view, while a condition that matches nothing is an ordinary empty answer.

§A closed vocabulary, deliberately

Two predicates — Has and Equals — and three combinators. That is enough to express the real filtering that exists today (a publishing audience: this document declares an audience, and it is public) and it is deliberately nowhere near an expression language.

Formulas are the point of no return for a view format: once views with arbitrary expressions exist in the wild, the expression grammar is load-bearing forever and every reader of the format has to implement it. A closed set of named predicates can grow one member at a time, each with a reason; a grammar cannot be taken back. So the rule for adding to this enum is a concrete lens that cannot otherwise be said — not a shape that seems likely to be wanted.

§The spelling

where:
  has: people                    # present, and not empty
  equals: { audience: public }   # carries this value

A mapping with several keys is an implicit and — every condition must hold. So is a list given to has:, and so is a multi-key equals:. The other two combinators are explicit:

where:
  any-of:
    - equals: { audience: public }
    - equals: { audience: friends }
  not:
    has: draft

Enums§

Condition
A condition a document’s metadata must satisfy.

Constants§

CONDITION_KEYS
The keys valid inside a where: block.