Lovely! very handy!
On Wed, May 5, 2021 at 10:16 PM Stobot <[email protected]> wrote: > I've thought about the concept myself a lot over the years, and ended up > deciding that if I was going to go that far, I might as well just use > filter notation. So rather than do something special for tags:myTerm I'd > just do [tag[myTerm]]. Yes, that's quite true, I always use $:/AdvancedSearch and it is very powerful! Just one point if you distribute your wiki to people with no or little TW knowledge the the Google search format is simple and more people know that! > Now you can't do that in the normal, main search box, but I have a sidebar > tab with kind of a persistent search area and I use prefix filtering to see > what kind of results I want. > * If I want a "system" based search I start the search string with "$" > * If I want a "shadow" based search, I start it with "!" > * If I want a "filter" based search, I start it with "[" > * If it has none of those, I just have it return regular results > > very clever! > Just for reference since you asked for wikitext, I have a normal <$edit..> > widget for the search box going to $:/temp/mysearch, and then down below is > the parsing. > > <$vars regfilter="^\[" regsystem="^\$" regshadow="^\!" > mysearch={{$:/temp/mysearch}} mysearchelse={{{ > [{$:/temp/mysearch}trim[$]trim[!]] }}}> > > <!-- Filter type search --> > <$list filter="[<mysearch>regexp<regfilter>]"> > <$list filter="[<mysearch>minlength[2]]" emptyMessage=""> > > //Filter results://<br> > <$list filter=<<mysearch>> emptyMessage="(no filter matches)"> > <$link>{{!!title}}</$link><br> > </$list><hr> > > </$list> > </$list> > > <!-- System type search --> > <$list filter="[<mysearch>regexp<regsystem>]"> > <$list filter="[<mysearchelse>minlength[2]]" emptyMessage=""> > > //Title contains://<br> > <$list filter="[is[system]search:title<mysearchelse>]" > emptyMessage="(no title matches)"> > <$link to={{!!title}}><$text text={{!!title}}/></$link><br> > </$list><hr> > > //Text contains://<br> > <$list filter="[is[system]search:text<mysearchelse>]" > emptyMessage="(no text matches)"> > <$link to={{!!title}}><$text text={{!!title}}/></$link><br> > </$list><hr> > > </$list> > </$list> > > <!-- Shadow type search --> > <$list filter="[<mysearch>regexp<regshadow>]"> > <$list filter="[<mysearchelse>minlength[2]]" emptyMessage=""> > > //Title contains://<br> > <$list filter="[all[shadows]search:title<mysearchelse>]" > emptyMessage="(no title matches)"> > <$link to={{!!title}}><$text text={{!!title}}/></$link><br> > </$list><hr> > > //Text contains://<br> > <$list filter="[all[shadows]search:text<mysearchelse>]" > emptyMessage="(no text matches)"> > <$link to={{!!title}}><$text text={{!!title}}/></$link><br> > </$list><hr> > > </$list> > </$list> > > <!-- Standard type search --> > <$list > filter="[{$:/temp/mysearch}!regexp<regfilter>!regexp<regsystem>!regexp<regshadow>!regexp[^\+]]"> > <$list filter="[{$:/temp/mysearch}minlength[2]]" emptyMessage=""> > > > //Title starts with://<br> > <$list filter=<<PrefixFilter>> emptyMessage="(no prefix matches)"> > <$link>{{!!title}}</$link><br> > </$list><hr> > > //Title contains://<br> > <$list filter=<<TitleFilter>> emptyMessage="(no title matches)"> > <$link>{{!!title}}</$link><br> > </$list><hr> > > //Text contains://<br> > <$list filter=<<TextFilter>> emptyMessage="(no text matches)"> > <$link>{{!!title}}</$link><br> > </$list> > > </$list> > </$list> > > Tested on tiddlywiki.com works like a charm! Thank you > On Wednesday, May 5, 2021 at 12:25:20 PM UTC-4 Mohammad wrote: > >> Note: in prefix:term space is not allowed! >> >> Best wishes >> Mohammad >> >> >> On Wed, May 5, 2021 at 8:53 PM Mohammad Rahmani <[email protected]> >> wrote: >> >>> This is a partial solution! >>> >>> 1. In tiddlywiki.com create a new tiddler and paste the below >>> wikitext >>> 2. Save and enter in the search box a prefix:term like >>> title:operator or tags:learnings >>> >>> >>> \define tidTemp() xx$:/temp/kookma/search >>> \define doSearch(field:"", term:"") >>> <$list filter="[all[tiddlers]!is[system]search:$field$:literal[$term$]]"> >>> >>> </$list> >>> \end >>> >>> <$edit-text tiddler=<<tidTemp>> field=text default="" tag=input/> >>> >>> <small>''Search for'': {{xx$:/temp/kookma/search}}</small> >>> >>> <!-- parse and search--> >>> <$list filter="[<tidTemp>get[text]enlist-input[]search:title[:]]"> >>> <$vars search-prefix={{{[<currentTiddler>split[:]first[]]}}} >>> search-term={{{[<currentTiddler>split[:]last[]]}}} > >>> <$list filter="[<search-prefix>!is[blank]] [<search-term>!is[blank]] >>> +[count[]match[2]]" variable=null> >>> <$macrocall $name=doSearch field=<<search-prefix>> term=<<search-term>> >>> /> >>> </$list> >>> </$vars> >>> >>> </$list> >>> >>> >>> Please comment to improve! If there is a previous solution please let me >>> know! >>> I like to parse the input for several prefix:term like Google! >>> >>> >>> Best wishes >>> Mohammad >>> >>> >>> On Wed, May 5, 2021 at 8:33 PM Mohammad Rahmani <[email protected]> >>> wrote: >>> >>>> Is there any plugin or wikitext to let search using search prefix and >>>> symbols? >>>> >>>> I mean like Google or GitHub using something like below >>>> >>>> title:myTiddler >>>> keywords:myKeywords >>>> tags:myTerm >>>> >>>> Here title and keywords and tags are search prefixes! In Tiddlywiki >>>> they are fields >>>> The symbol is colon(:) >>>> >>>> So a prefix:term is the format to use a simple search box but do a >>>> more precise search! >>>> >>>> >>>> Best wishes >>>> 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/dfe1c5b6-6a30-46fe-96ce-9ad5b6a8e58dn%40googlegroups.com > <https://groups.google.com/d/msgid/tiddlywiki/dfe1c5b6-6a30-46fe-96ce-9ad5b6a8e58dn%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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/CAAV1gMAV-rwe%3DSe1JO%2BeDgjOV3c-7FJtPs3BEvhVvEv%2B92Sc6g%40mail.gmail.com.

