My use case is a music player for ripped CDs (mostly classical music). The music (FLAC files) is not stored in my wiki but resides in a files folder. The tiddlers for the movements/tracks (a separate tiddler for each movement/track) contain only metadata, which lets me search the music using a dozen different search fields. But besides playing music, after a while I also felt the need to interrogate the metadata, for which I needed a (general use-case independent) way to query multiple fields. My implementation is as follows:
\define getField(field)
{{{ [<currentTiddler>get[$field$]else[-]] }}}
\end
\define addSeparator(isLast)
{{{ $isLast$ +[match[no]search-replace[no],[,]] }}}
\end
\procedure query()
<$list filter={{!!_query-from}}>
<$list filter=[{Query!!_query-fields}split[,]trim[]] variable="field" counter="i">
<<getField $(field)$>><<addSeparator $(i-last)$>>
</$list><br>
</$list>
\end
from:
<$edit-text tag=textarea class="query-from" autoHeight="no" field="_query-from"/>
fields:
<$edit-text tag=textarea class="query-fields" autoHeight="no" field="_query-fields"/>
<div class="query-result">
<<query>>
</div>
(CSS not shown).
Two textareas are used, one for the from clause and another one for the fields to be queried. The clauses are stored in the _query-from and _query-fields fields respectively
The from clause must be a filter that returns tiddler titles. The fields clause must be a comma separated list of field names. There is no limitation on the number of fields that can be queried. White space can be used freely. To make this clearer an example is shown.
So far my queries have been very helpful, not in the least to help me find errors and omissions in the metadata.
May, I hope, or may not be useful.