Operator Type:
Operator Scope of Action:
Operator Purpose:
Operator First Added:
Operator Altered:
Function [other Function type actions]
Item [operators of similar scope]
Query Boolean [other Query Boolean operators]
Baseline
contains("item")
Returns Boolean true if the note evaluated from item is a direct child of the current note or, put conversely, if the note is the parent of item. Thus it can be thought of as an "is parent of" operator and, as such, a counterpart to the "is a child of" operator inside().
The item parameter must be quoted unless an attribute reference. Ways to define item.
Legacy support: this replaces the legacy #contains query operator.
Examples:
contains(/foo)
This is a full path so can match only the root-level note 'foo'. But:
contains("bar")
could match any note with the name 'bar' of which there may be more than one. If there is more that one, Tinderbox chooses one. This is fine if one match was desired but if there are known to be multiple 'bar' notes and it is desired to locate parent container of every one, then a different approach is needed, using any(): the process is described under any().
NOTE: Checking attribute values, as opposed to object containment
There are a range of other tools to check if a String-, List- or Set-type attribute's value contains a desired search pattern.
- For String attributes there are String.contains() and String.icontains().
- List and Set date type attributes also support .contains() and .icontains() though in this context the scope of pattern matches is slightly different from that with a String-type attribute (see the linked articles).
- Single words alone can be checked using word(), which works across $Name, $Text and all String-type attributes.