On Friday, May 15, 2020 at 12:21:34 AM UTC-7, yrosgi L wrote:
>
> For example, there is a query text "[tag[todo]]" in a tiddler.
> What it should link to is the search page (like 
> "$:/core/ui/AdvancedSearch/Filter") but listed the result of the query text.
>
> Personally I think it is impossible because I haven't find a way to pass 
> the value to the search page.
> And now I just link to a tiddler that manually provide the result.
>

It is actually relatively easy to do.  Start by creating the following 
macro definition (in a tiddler tagged with $:/tags/Macro):
\define filtersearch(filter)
<$button class="tc-btn-invisible">
<$text text="""$filter$""" />
<$action-navigate $to="$:/AdvancedSearch"/>
<$action-setfield $tiddler="$:/state/tab--1498284803" text=
"$:/core/ui/AdvancedSearch/Filter" />
<$action-setfield $tiddler="$:/temp/advancedsearch" text="""$filter$""" />
</$button>
\end

What it does:
* pass the desired filter syntax as a macro parameter
* create a button that displays the filter as normal text (no 
border/background)
* this button performs three actions:
   1) open the $:/AdvancedSearch tiddler
   2) select the "Filter" tab by setting the text of 
*$:/state/tab--1498284803* to *$:/core/ui/AdvancedSearch/Filter*
   3) set the text of *$:/temp/advancedsearch* to search for the desired 
filter syntax

To call the "filtersearch" macro from within your content, write something 
like:
This is some text to search for <<filtersearch "[tag[todo]">> within this 
document

Note:
Step 2 references a specific "$:/state/tab" tiddler that includes a unique 
"magic number" which is generated by the <<qualify>> macro (see 
https://tiddlywiki.com/#qualify%20Macro).  I found the appropriate 
$:/state/tab tiddler by using the AdvancedSearch/Filter tab to search for "
*[prefix[$:/state/tab]text[$:/core/ui/AdvancedSearch/Filter]]*".  This 
magic number should be the same for all TiddlyWiki documents that use the 
standard shadow definition for the $:/AdvancedSearch tiddler.

enjoy,
-e
Eric Shulman
TiddlyTools.com: "Small Tools for Big Ideas!" (tm)
InsideTiddlyWiki - http://TiddlyTools.com/InsideTW

-- 
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/2fd09434-dff2-421f-ac5b-ae37c7dbc867%40googlegroups.com.

Reply via email to