On Saturday, August 29, 2020 at 11:24:46 AM UTC-7, Eric Shulman wrote:
>
> \define searchflds() {{{ [search:$(flds)$[query]] }}}
>
> <$list filter="[fields[]regexp[_plac$]]" variable="flds">
> <<searchflds>>
> </$list>
>
 
Addendum:

The above code will work, but... it searches for each field name 
separately.  As a result, if there are multiple fieldnames in the same 
tiddler that contain the query text, that tiddler will be listed multiple 
times.

Your intuition to use "join[,]" to construct a list of fields is actually 
the better approach.  Thus:
<$vars flds={{{ [fields[]regexp[_plac$]join[,]] }}}>
<<searchflds>>
</$vars>

Notes:
* the $vars finds all fieldnames ending in "_plac" and assembles a 
comma-separated list
* the searchflds macro then uses that list of fieldnames to find the 
occurrences of "query" within any of those fields

Because the search is looking in all of the "_plac" fieldnames at the same 
time, any matching tiddlers are only listed once.

-e

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/51308e38-52e0-4dd8-b042-1651266f73aco%40googlegroups.com.

Reply via email to