Advanced Search Results sorting

62 views
Skip to first unread message

niclas....@googlemail.com

unread,
May 20, 2021, 7:27:43 AM5/20/21
to TiddlyWiki
Hi TiddlyCommunity,
I came up with a little bit of code myself. I found it from a old post and it basicly uses the Standard Advanced Search to find all user fields that have the searched word and link the Tiddlers. I copied the Advanced Search core Tiddler to have everything on one Tiddler, but the problem is it only works when i put it after the fieldfilter. My Code looks like this:

\define searchInField(field, for)
<$list filter="[!is[shadow]!is[system]field:$field$/$for$/]">$field$: 
<ul><li><$link><$view field="title"/></$link> </li></ul></$list>
\end
<$reveal state="$:/temp/advancedsearch" type="nomatch" text="">

<$list filter="[!is[shadow]!is[system]fields[]] -title -text -tags" variable="fieldname">
<$macrocall $name="searchInField" field=<<fieldname>> for={{$:/temp/advancedsearch}}/> 
</$list>
</$reveal>

<div class="tc-advanced-search">
<$macrocall $name="tabs" tabsList="[all[shadows+tiddlers]tag[$:/tags/AdvancedSearch]!has[draft.of]]" default="$:/core/ui/AdvancedSearch/System" actions="""<$action-setfield $tiddler="$:/state/advancedsearch/currentTab" text=<<currentTab>>/>""" explicitState="$:/state/tab--1498284803"/>
</div>
 
I want to put the Advanced Searchbar first. Its probably not that hard but i fail at it anyways. So how do i get it on top of the filter?
And my second question is, how do i modify the fieldfilter list. Currently the filter displays the matching fields and the linked Tiddler one by one. Is there a way to combine them into one list for each user field? For example i combine all Linked Tiddler with the user field "field1" into a list and all user field "field2" into one list. Because right now it displays them separate. So when i search for "person" it looks like this:

field1:
  • Tiddler1
field1:
  • Tiddler2
field2:
  • Tiddler3
field2:
  • Tiddler4
But it would look better if it lists them as:

field1:
  • Tiddler 1
  • Tiddler 2
field2:
  • Tiddler 3
  • Tiddler 4
The code itself does exactly what i want but its looks not that nice. I would appreciate an suggestion. Thanks

niclas....@googlemail.com

unread,
May 21, 2021, 4:22:23 AM5/21/21
to TiddlyWiki
Ok I managed to get the advanced search bar on top myself. Now I only want to combine my search results as described above. My Code now looks like this:

\define searchInField(field, for)

<$list filter="[!is[shadow]!is[system]field:$field$/$for$/]">$field$: 
<ul><li><$link><$view field="title"/></$link> </li></ul></$list>
\end

<div class="tc-advanced-search">
<$macrocall $name="tabs" tabsList="[all[shadows+tiddlers]tag[$:/tags/AdvancedSearch]!has[draft.of]]" default="$:/core/ui/AdvancedSearch/System" actions="""<$action-setfield $tiddler="$:/state/advancedsearch/currentTab" text=<<currentTab>>/>""" explicitState="$:/state/tab--1498284803"/>
</div>

<$reveal state="$:/temp/advancedsearch" type="nomatch" text="">

<$list filter="[!is[shadow]!is[system]fields[]] -title -text -tags" variable="fieldname">
<$macrocall $name="searchInField" field=<<fieldname>> for={{$:/temp/advancedsearch}}/> 
</$list>
</$reveal>

Thanks if someone can help me.

Reply all
Reply to author
Forward
0 new messages