On Wednesday, December 11, 2019 at 9:59:39 PM UTC-8, Mohammad wrote: > > Search operator https://tiddlywiki.com/prerelease/#search%20Operator > has flag list, field list and operand! I want to have a list widget and > search through some tiddlers pragmatically! > so everything is a variable! > > field: transcluded from temp/search/field > term: transcluded from temp/search/term > flag: transcluded from temp/search/flag > > so for example > \define field() temp/search/field > \define term() temp/search/term > \define flag() temp/search/flag > \define searchTerm() {{$(term)$!!text}} > > <$list filter="[tag[xx]search:{$(field)$}:{$(flag)$}[$(searchTerm)$]]"> > > > </$list> > no success, I know something wrong with variables >
There are two problems with your example code: 1) you can't use the $(variable)$ syntax unless you are within a macro 2) The [search:field:flags[...]] filter can't use transclusion for substitution in the field and flags part of the syntax. Also, 3) If you don't provide a tag value, it won't match anything. To avoid this, use the tag:strict[...] filter syntax 4) You haven't provided any control over what kinds of tiddlers to search. To add this, put an all[...] filter at the beginning Here's my solution, which I have uploaded to http://tiddlytools.com/filtergenerators.html \define tidinput() $:/temp/search/tid \define taginput() $:/temp/search/tag \define fieldinput() $:/temp/search/field \define terminput() $:/temp/search/term \define flaginput() $:/temp/search/flag \define doSearch() <$vars filter= """[all[$(tids)$]tag:strict[$(tag)$]search:$(field)$:$(flag)$[$(term)$]]"""> There are <$count filter=<<filter>>/> tiddlers matching ''<$text text=<<filter>>/>'' <blockquote> @@.columns3.small <$list filter=<<filter>>><$link/><br></$list>@@ </blockquote> </$vars> \end | tiddlers to search:|<$edit-text tiddler=<< tidinput>> tag="input" default="" placeholder="tiddlers" />| | tag for search:|<$edit-text tiddler=<< taginput>> tag="input" default="" placeholder="enter a tag" />| | field(s) for search (comma-separated field names):|<$edit-text tiddler=<< fieldinput>> tag="input" default="" placeholder="title,text,tags" />| | flag(s) for search (comma-separated keywords):|<$edit-text tiddler=<< flaginput>> tag="input" default="" placeholder="words" />| | text to search for:|<$edit-text tiddler=<< terminput>> tag="input" default="" placeholder="enter search text" />| <$vars tids={{{ [<tidinput>get[text]] ~[[tiddlers]] }}} tag={{{ [<taginput>get[text]] }}} field={{{ [<fieldinput>get[text]] ~[[title,text,tags]] }}} flag={{{ [<flaginput>get[text]] ~[[words]] }}} term={{{ [<terminput>get[text]] }}}> <<doSearch>> </$vars> enjoy, -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/fe3d513d-2ebe-4db9-8e01-4c08528ff7c4%40googlegroups.com.