Let’s build your filters step-by-step…
First, to get a list of all tiddlers tagged with “TagA”, you can write: [tag[TagA]]
, and to get a list of all tiddler tagged with “TagB”, you can write: [tag[TagB]]
. Then, you can combine these separate filter runs, like this:
[tag[TagA]] [tag[TagB]]
Note how each filter run has its own enclosing outer square brackets, and the filter runs are separated by a space. Each filter run produces a list of matching tiddlers, which are then combined to produce the final results. Note that by default, the filter syntax automatically removes duplicates from the final results, so if the same tiddler is tagged with both “TagA” AND “TagB”, it will still only occur ONCE in the final results. Thus, the above combined filter is effectively saying “find all tiddlers that have TagA OR TagB (or both)”, which is what you want.
In contrast, suppose you were to write:
[tag[TagA]tag[TagB]]
where there is only one set of enclosing outer square brackets and no space between the two tag[...]
operators. This will find all tiddlers that have TagA… and then only keep those tiddlers that ALSO have TagB. This is effectively saying “find all tiddlers that have BOTH TagA AND TagB”
To complete your filter syntax, all that remains is to eliminate any “draft” tiddlers, and sort the results by title.
To remove the draft tiddlers from the list, you can add a filter run, -[has[draft.of]]
. Note the leading “-” sign before the enclosing square brackets of this filter run. This means “remove any tiddlers that match the following filter”.
To sort the final results, you can add a filter run, +[sort[]]
. Note the leading “+” sign before the enclose square brackets of this filter run. This means “apply the following filter to all tiddlers matched so far”. Note also that the title
parameter can be omitted from the sort[...]
operator, since that is the default field used when no field name is specified.
Take note that the tag[...]
operator is highly optimized by the TWCore which automatically caches an “index” of all tiddlers by tag, so it is very efficient to find tagged tiddlers. However, the has[...]
and sort[...]
operators, while still reasonably fast, are less performant because they need to actually retrieve individual tiddler data to examine each of their field values. Thus, it is better to check for the draft.of
field and sort the results AFTER reducing the list of tiddlers by matching tags first.
Putting it all together, your final filter syntax should be:
<$list filter="[tag[TagA]] [tag[TagB]] -[has[draft.of]] +[sort[]]" />
Hope this explanation helps… let me know how it goes.
enjoy,
-e