Very little, except that a filter run that has a filter run prefix can contain an operator with a filter operator suffix. For example:
[tag[HelloThere]] :intersection[search:title:casesensitive[TiddlyWiki]]
Example 1
Here we have two filter runs, [tag[HelloThere]]
and :intersection[search:title:casesensitive[TiddlyWiki]]
. The :intersection
is a filter run prefix: it precedes an entire filter run and modifies the relationship between filter run #1 and filter run #2.
For comparison, here’s the results of these same two filter runs without any filter run prefixes:
Example 2
If you’ve ever studied set theory in math or logic, I think it’s a good way to conceptualize some basic filter runs.
- When you include multiple unprefixed filter runs in the same filter, the filter’s output is the union of the results of each individual filter run. (This is technically identical to using the
:or
filter run prefix on each filter run after the first—but, to be honest, I’ve never seen a real-life example of :or
.)
- Using the
:intersection
filter run prefix on the second filter run gives you the intersection of filter run #1 and filter run #2. This is the six-result list we saw above.
- The results of a multi-run filter are deduplicated, by default—so while the six results in Example 1 appear among the results of both individual filter runs, they don’t appear twice in the Example 2 results. To prevent deduplication, we could use the filter run prefix
:all
(or its shortcut =
):
Example 3
There are several additional filter run prefixes, and not all of them map so neatly onto set theory concepts, but I hope this illustrates the general idea: Filter run prefixes modify the relationship between filter runs.
Let’s set the filter run prefix aside for now and break down the content of the second filter run.
[search:title:casesensitive[TiddlyWiki]]
- filter step:
search:title:casesensitive[TiddlyWiki]
- filter operator:
search
- filter parameter:
[TiddlyWiki]
- parameter type: literal string (as indicated by the
[]
around the parameter)
- filter operator suffix(es):
:title:casesensitive
A filter step = one filter operator (with optional suffixes) and 1+ parameters, as indicated by the operator’s documentation.
-
search
takes a single parameter; search-replace
takes two.
- A few filter operators such as
unique
and enlist-input
do not take parameters at all: they’re used in the forms unique[]
and enlist-input[]
. Any content that appears in what would be the parameter slot is simply ignored.
I used search
for this example specifically because it is one of the filter operators that does use (optional) operator suffixes, as indicated in the docs:
The search operator uses an extended syntax that permits multiple fields and flags to be passed:
[search:<field list>:<flag list>[<parameter>]]
field list: a comma delimited list of field names to restrict the search
- defaults to tags, text and title if blank
- an asterisk * instead of the field list causes the search to be performed across all fields available on each tiddler
- preceding the list with a minus sign - reverses the order so that the search is performed on all fields except the listed fields
flag list: a comma delimited list of flags (defaults to words if blank)
parameter: filter parameter
(Personally, I find the use of <angle brackets>
in operator syntax diagrams somewhat confusing: none of these are variables in the TW sense, and you should not be using angle brackets in this way in real filter steps. But this is the convention the docs use, so it’s best to get used to it. IMHO, a visual designation like color-coding might be clearer if we could do it in an accessible way.)
In any case, in my example [search:title:casesensitive[TiddlyWiki]]
…
- the field list is
title
(If I omitted the title list, as in search::casesensitive[TiddlyWiki]
or search[TiddlyWiki]
, the default title list title,tags,text
would be used instead.)
- The flag list is
casesensitive
. (search
is case-insensitive by default, so search[TiddlyWiki]
and search[tiddlywiki]
would produce the same results.)
Filter operator suffixes modify the default behavior of filter operators. Some operator suffixes (like those used by search
and field
) include the names of tiddler fields; others, like compare
and prefix
, do not.
- You can get a full list of filter operator suffixes by pasting this filter into the Filter tab of Advanced Search:
[has[op-suffix]]
And here’s one final twist: A filter run prefix can take its own suffix, as we see with :map
and :sort
. For instance, I used the suffixed filter run prefix :map:flat
in the multi-run filter I wrote for you the other day (as well as the “basic” filter run prefix :else
/~
in the associated function).