*Version V* Search Using Prefixes - iv supports operators Use + to include and - to exclude This version also support single term and mixed form e.g (title:HelloThere novel)
- use prefix:term to search in field=prefix for term - use title:test will search in title field for term test - no space between colon(:) and words allowed - using two or more prefix:term pairs returns result to meet both/all criteria - using - operator exlcudes results, e.g -title:term excludes results with term in the title - using + operator includes results, e.g +title:term includes results with term in the title. This is the default behaviour - search minimum length: 3, search only triggers if term length is greater than this value - maximum number of output: To give a try download, drag and drop to tiddlywiki.com Best wishes Mohammad On Thu, May 6, 2021 at 2:04 AM Mohammad Rahmani <[email protected]> wrote: > Version II > > This is a more polished version of 'prefix:term' or Google like search box. > > What is new: > > - search like created:2020 title:operator which returns results to > meet both criteria > - search filter is displayed > - search tips can be displayed on demand using details element > - search limits and minlength has their own variable to be set easily > > > Please give your comments to improve the code. For example improve the > parser for a simpler > more semantic script! > > To give a try drag and drop the attached file into tiddlywiki.com and see > how it works! > > \define searchTips() > <details> > <summary><small>Search tips</small></summary> > <ul> > <li>use `prefix:term` to search in field=prefix for term</li> > <li>use `title:test` will search in `title` field for term `test`</li> > <li>no space between colon(`:`) and words allowed</li> > <li>using two or more `prefix:term` pairs returns result to meet both/all > criteria</li> > </ul> > </details> > \end > > > \define tidTemp() xx2$:/temp/kookma/search > \define minlength-searchterm() 2 > \define limit-output() 250 > \define searchFilter() [all[tiddlers]!is[system]] $(sterms)$ > +[limit[$(limit-output)$]] > \define populates() +[search:$(search-prefix)$:literal[$(search-term)$]] > > \define parser() > <!-- parse the search term--> > <$list filter="[<tidTemp>get[text]enlist-input[]search:title[:]]"> > <$vars search-prefix={{{[<currentTiddler>split[:]!is[blank]first[]]}}} > search-term={{{[<currentTiddler>split[:]!is[blank]last[]]}}} > > <$list filter="[<search-prefix>!is[blank]] > [<search-term>minlength[$(minlength-searchterm)$]] +[count[]match[2]]" > variable=null> > <$text text=<<populates>> /> > </$list> > </$vars> > </$list> > \end > > > <!-- styles --> > <style>.wd{width:50%;}</style> > > <$edit-text tiddler=<<tidTemp>> field=text default="" tag=input class=wd/> > <<searchTips>><!-- display help on demand --> > > <$wikify name=sterms text=<<parser>> ><!-- parse and wikify the search > terms --> > <small>''Search terms'': <$text text=<<sterms>> /></small> > > <$list filter="[<sterms>trim[]!is[blank]]" variable=null> <!-- check for > correct input, do not trigger search on empty input --> > <$list filter=<<searchFilter>> > > > </$list> > </$list> > </$wikify> > > > The temp tiddler has a name xx2$ for debugging purposes! change as you > like! > > > > 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/CAAV1gMAx%2Bqik4VPmdqnKuZfBj3SBn7EyKw9%2BkUCmT7V0NpZk8Q%40mail.gmail.com.
Search Using Prefixes - v working case 2.json
Description: application/json

