Query expression
A query expression allows you to search for specific zettel and to perform some actions on them. You may select zettel based on a full-text search, based on specific metadata values, or both.
A query expression consists of a search expression and of an optional action list. Both are separated by a vertical bar character (|
, U+007C).
A query expression follows a formal syntax.
Search expression
In its simplest form, a search expression just contains a string to be search for with the help of a full-text search. For example, the string syntax will search for all zettel containing the word syntax
.
If you want to search for all zettel with a title containing the word syntax
, you must specify title:syntax. title
names the metadata key, in this case the supported metadata key title
. The colon character (:
) is a search operator, in this example to specify a match. syntax
is the search value that must match to the value of the given metadata key, here title
.
A search expression may contain more than one search term, such as title:syntax. Search terms must be separated by one or more space characters, for example title:syntax title:search. All terms of a select expression must be true so that a zettel is selected.
Here are some examples of search expressions, which can be used to manage a Zettelstore:
Query Expression | Meaning |
role:configuration | Zettel that contains some configuration data for the Zettelstore |
ORDER REVERSE created LIMIT 40 | 40 recently created zettel |
ORDER REVERSE published LIMIT 40 | 40 recently updated zettel |
PICK 40 | 40 random zettel |
dead? | Zettel with invalid / dead links |
backward!? precursor!? | Zettel that are not referenced by other zettel |
tags!? | Zettel without tags |
Action List
With a search expression, a list of zettel is selected. Actions allow to modify this list to a certain degree.
Which actions are allowed depends on the context. However, actions are further separated into parameter action and aggregate actions. A parameter action just sets a parameter for an aggregate action. An aggregate action transforms the list of selected zettel into a different, aggregate form. Only the first aggregate form is executed, following aggregate actions are ignored.
In most contexts, valid actions include the name of metadata keys, at least of type Word, WordSet, or TagSet.