On Thursday, December 12, 2019 at 11:04:09 AM UTC+3:30, Eric Shulman wrote: > > 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 >> > > Many thanks Eric!
> There are two problems with your example code: > > 1) you can't use the $(variable)$ syntax unless you are within a macro > That is right! I use the $list in above code inside a macro! > 2) The [search:field:flags[...]] filter can't use transclusion for > substitution in the field and flags part of the syntax. > I did not know this, it seems only operand can be directly transcluded! > > Also, > 3) If you don't provide a tag value, it won't match anything. To avoid > this, use the tag:strict[...] filter syntax > I do not understand this quite well! I have seen this before in https://tiddlywiki.com/prerelease/#tag%20Operator what really strict does mean here? > 4) You haven't provided any control over what kinds of tiddlers to > search. To add this, put an all[...] filter at the beginning > Isn't it it assume all[tiddlers] ? > > Here's my solution, which I have uploaded to > http://tiddlytools.com/filtergenerators.html > This is great! A one place for filter solution and for later use! a codepen like for Tiddlywiki (live experimenting) I will email David to add to tiddlywiki toolmap! > > \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> > > *Comments:* - I understand $var widget has filter input parameter, not documented and I always use set for this purpose - I should be able to use regexp as search flag and this will give higher flexibility Thanks again! Every answer like this is small lesson in wikitext scripting. > 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/b14c8283-c13d-4627-ad40-430028631c8c%40googlegroups.com.

