Added to TW-Scripts
https://kookma.github.io/TW-Scripts/#Combo%20Search%3A%20Standard%20and%20Filter%20Search

On Thursday, December 19, 2019 at 9:30:17 AM UTC+3:30, Mohammad wrote:
>
> This may be answered already, but I could not find in in the forum
>
>
> *idea*: have a search box (an $edit-text) which lets you to search both 
> by filter and by simple keywords
> *use case*: one search box and do both standard and filter search
>
> *a quick proposal*
>
> Create a tiddler in https://tiddlywiki.com/prerelease/
> put the below text inside and give a try.
> perform searches like standard search and then like filter search and let 
> me know your feedback.
>
> \define standardSearch()
> Standard search<br><!--for debugging-->
> <$list filter="[search:title,caption,text[$(searchTerms)$]]">
> <$link/><br>
> </$list>
> \end
>
> \define filterSearch()
> Filter search<br><!--for debugging-->
> <$list filter=<<searchTerms>> >
> <$link/><br>
> </$list>
> \end
>
> \define combo-search()
> <$vars pattern="^\["
>        stateTid="$:/temp/comboSearch">
>  
> <!--UI -->
> combo search &nbsp;<$edit-text tiddler=<<stateTid>> tag=input/>  
>
> <!-- show results if any-->
> <$reveal state=<<stateTid>> type="nomatch" text=""><!--do not display when 
> searchbox is empty-->
> <$set name=searchTerms tiddler=<<stateTid>> field=text>
> <$list filter="[<searchTerms>minlength[3]limit[1]]" emptyMessage="Search 
> text too short" variable=ignore>
> <!-- Check input search term -->
> <$list filter="[<searchTerms>regexp<pattern>]" 
> emptyMessage=<<standardSearch>> >
>  <<filterSearch>>
> </$list>
> </$list>
> </$set>
> </$reveal>
> </$vars>
> \end
>
> <<combo-search>>
>
>
> *Question*:
>
>    1. what is the best regexp pattern here?
>    2. how to improve the performance
>
> --Mohammad
>

-- 
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/c977728d-9e83-4d3b-8278-2f5fcf4272e9%40googlegroups.com.

Reply via email to