(TW5) Question about filtering with multiple tags

1,253 views
Skip to first unread message

mondayrobot

unread,
Nov 17, 2015, 1:03:53 AM11/17/15
to TiddlyWiki
Hello everyone,

Do you guys know if it's possible to Is it possible to make an option to update a filter visually (selecting from a dropdown list or using checkboxes or something similar)?  I want this to be invisible to the end-user in a read only file, so without "manually" editing the tiddler. I already looked at the Select widget,  but it seems it doesn't accept multiple arguments.

Use case :I have a list of tiddlers using different tags (A, B, C and D). I want an option to select one or more tags (using  multiple dropdown lists or checkboxes) that will update the list accordingly --> so if I choose tags A and B, it will show me only the tiddlers tagged with A and B ; if I choose the tags A, B and D, it will show me only the tiddlers tagged with A, B and D...

Thanks so much for your help.

Tobias Beer

unread,
Nov 17, 2015, 4:33:15 AM11/17/15
to tiddl...@googlegroups.com
Hi mondayrobot,

I've been working on a solution using a new filter I just created called join.

However, the problem is that currently the list does not update when toggling the selection of any tags.
In other words, the list currently is only updated by closing and opening the tiddler again.

To possibly remedy that situation, I have opened that ticket:

#2081 refreshing widgets
https://github.com/Jermolene/TiddlyWiki5/issues/2081

Best wishes,

— tb

Jed Carty

unread,
Nov 17, 2015, 5:27:56 AM11/17/15
to TiddlyWiki
I have two solutions to this, neither are very good. One is used in my bookmarks plugin. Unfortunately it is only a partial solution and it is a pain to implement. The other one is to have a bunch of checkboxes or select widgets like this:

\define thisMakeList()
<$list filter='[all[]$(Tag1)$$(Tag2)$$(Tag3)$$(Tag4)$]'>

</$list>
\end

List of tags:
<$checkbox tiddler='$:/
state/Selected Tiddlers' field=tag1_field checked='tag[HelloThere]' unchecked=''>tag1</$checkbox>

<$checkbox tiddler='
$:/state/Selected Tiddlers' field=tag2_field checked='tag[Examples]' unchecked=''>tag2</$checkbox>

<$checkbox tiddler='
$:/state/Selected Tiddlers' field=tag3_field checked='tag[tag3]' unchecked=''>tag3</$checkbox>

<$checkbox tiddler='
$:/state/Selected Tiddlers' field=tag4_field checked='tag[tag4]' unchecked=''>tag4</$checkbox>

Results:

<$vars Tag1={{$:/state/Selected Tiddlers!!tag1_field}} Tag2={{$:/state/Selected Tiddlers!!tag2_field}} Tag3={{$:/state/Selected Tiddlers!!tag3_field}} Tag4={{$:/state/Selected Tiddlers!!tag4_field}}>

<<thisMakeList>>

</$vars>


Which works, but is a pain to make since you have to manually add each new tag to 3 places (the filter expression, the checkbox and the vars widget).

Hopefully we can figure out the refresh problem in the solution Tobias gave. I think it has something to do with the set widget not refreshing properly when it is given a filter.

Sylvain Naudin

unread,
Nov 17, 2015, 7:26:09 AM11/17/15
to TiddlyWiki
Thanks @mondayrobot to ask and @Tobbias for this example ! It's promising !!

Regards
Sylvain

Tobias Beer

unread,
Nov 17, 2015, 8:27:49 AM11/17/15
to tiddl...@googlegroups.com
Hi again,

I looked into the list widget and figured that 5.1.10-prerelease does have the required refresh handling.

So, I updated the example on at the join-filter demo and added a button to quickly reset the selected tags.

Works nicely. ;-)

Next steps: filter documentation / tests / pull request.

Best wishes,

— tb

Jeremy Ruston

unread,
Nov 17, 2015, 10:41:13 AM11/17/15
to tiddl...@googlegroups.com
As Jed says, I think the problem under discussion here is with the set widget: pre-5.1.10 it wasn’t correctly refreshing if the results of a filter changed. Tobias has already submitted a partial fix for the problem in 5.1.10, but a quick review suggests that it is still broken. I’ll have a proper look at it after the hangout,

Best wishes

Jeremy

On 17 Nov 2015, at 13:27, Tobias Beer <beert...@gmail.com> wrote:

Hi again,

I looked into the list widget and figured that 5.1.10-prerelease does have the required refresh handling.

So, I updated the example on at the join-filter demo and added a button to quickly reset the selected tags.

Works nicely. ;-)

Best wishes,

— tb

--
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+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/db272711-f2d8-4aaf-8e73-ed0f18b92a6c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

mondayrobot

unread,
Nov 17, 2015, 12:26:29 PM11/17/15
to TiddlyWiki
Thank you all!

Best wishes

Tobias Beer

unread,
Dec 29, 2015, 6:23:55 AM12/29/15
to TiddlyWiki
For reference, I published tobibeer/join as a plugin:


Best wishes,

Tobias.

Matabele

unread,
Dec 29, 2015, 11:53:58 PM12/29/15
to TiddlyWiki
Hi mondayrobot

I have made an example which might provide a basis for what you are looking for (using my new Checklist widget)

I have posted my example on the widget wiki here.

regards


On Tuesday, 17 November 2015 08:03:53 UTC+2, mondayrobot wrote:
Do you guys know if it's possible to make an option to update a filter visually (selecting from a dropdown list or using checkboxes or something similar)? 

Matabele

unread,
Dec 30, 2015, 12:03:25 AM12/30/15
to TiddlyWiki
Hi mondayrobot

This can be built using the Checkbox widget -- I have attached an example -- download the file and drop it onto your wiki.

regards 

On Tuesday, 17 November 2015 08:03:53 UTC+2, mondayrobot wrote:
Select Example.tid

Matabele

unread,
Dec 30, 2015, 1:10:37 AM12/30/15
to tiddl...@googlegroups.com
Hi mondayrobot

OK -- I have attached a tiddler which contains an example hack to AND the selected tags together in the filter expression.

regards

On Tuesday, 17 November 2015 08:03:53 UTC+2, mondayrobot wrote:
Do you guys know if it's possible to Is it possible to make an option to update a filter visually (selecting from a dropdown list or using checkboxes or something similar)? 
 
 so if I choose tags A and B, it will show me only the tiddlers tagged with A and B ; if I choose the tags A, B and D, it will show me only the tiddlers tagged with A, B and D...
Select Example (and).tid

J Mc

unread,
Nov 18, 2016, 6:29:38 AM11/18/16
to tiddl...@googlegroups.com
@ Matabele

Hi Matabele,

I used your first example and it works a treat. I was wondering whether it is possible to do another two things

1) remove the tag from the list tiddler as the output shows this tiddler with the selected (checkbox) tiddlers

2) add a checkbox to the output tiddlers


I would like to tag a list of parts tagged part and show each with a checkbox that when checked would tag them as parts list. I could then list these in a separate tiddler with all tiddlers tagged with parts list
Hope you can help

Thanks

Select Example 1.tid

Surya

unread,
Feb 13, 2018, 4:59:08 PM2/13/18
to TiddlyWiki
Hello Jed,

I am searching now for such a long time for a search / filter - possibility, where I can see my tags and choose them with checkboxes to build a search / filter by the choosen tags (with an AND command).

I have found this, which works for me very fine:


\define thisMakeList()
<$list filter='[all[]$(Tag1)$$(Tag2)$$(Tag3)$$(Tag4)$]'>

</$list>
\end

List of tags:
<$checkbox tiddler='$:/
state/Selected Tiddlers' field=tag1_field checked='tag[HelloThere]' unchecked=''>tag1</$checkbox>

<$checkbox tiddler='
$:/state/Selected Tiddlers' field=tag2_field checked='tag[Examples]' unchecked=''>tag2</$checkbox>

<$checkbox tiddler='
$:/state/Selected Tiddlers' field=tag3_field checked='tag[tag3]' unchecked=''>tag3</$checkbox>

<$checkbox tiddler='
$:/state/Selected Tiddlers' field=tag4_field checked='tag[tag4]' unchecked=''>tag4</$checkbox>

Results:

<$vars Tag1={{$:/state/Selected Tiddlers!!tag1_field}} Tag2={{$:/state/Selected Tiddlers!!tag2_field}} Tag3={{$:/state/Selected Tiddlers!!tag3_field}} Tag4={{$:/state/Selected Tiddlers!!tag4_field}}>

<<thisMakeList>>

</$vars>

Yes, it really is a pain to make this (I have in most of my wikis about 50-150 tags for searching/filtering...), but if it fulfill my wishes for a Multiple Tag Search, then no pain is too hard for me ;-)


But I have some questions for it, to have some "cream toppings" on it:

The most important one:
I want to see before the list-results, which tags I have choosen. I made it with this:

Choosed Tags:
<$list filter="[tag[Searchtest]]">
{{!!tag1_field}} {{!!tag2_field}} {{!!tag3_field}} {{!!tag4_field}} {{!!tag5_field}}
</$list>

But that is not really nice to look at it and it confuses a lot- especially for users who don't know anything about Tiddlywiki, visit my site, .
When I choosed tag "A" & "B", it shows Choosed Tags: tag[A] tag[B]
Is it possible, to show just Choosed Tags: A B?

And really fantastic would be, to have the choosen tags shown as their tag-labels (I mean with their colour & the rounded coloured shape around it).
And also really fantastic would be, to have the little x in it, to remove them very fast from the search.

Is that possible?

Thanks in advance to you :-)
Surya

Surya

unread,
Feb 13, 2018, 5:08:53 PM2/13/18
to TiddlyWiki
Hello Jed again,

I made a search / filter with that on my test-wiki (http://suryas-testwiki.tiddlyspot.com/) and called it "MultipleTagSearch by Jed Carty".
All related tiddlers are tagged with "Searchtest".

I really hope for an answer from you and that you can help with this :-)
Surya

ste...@gmail.com

unread,
Feb 17, 2018, 10:01:02 AM2/17/18
to TiddlyWiki
Hi,


On Tuesday, November 17, 2015 at 7:03:53 AM UTC+1, mondayrobot wrote:

Use case :I have a list of tiddlers using different tags (A, B, C and D). I want an option to select one or more tags (using  multiple dropdown lists or checkboxes) that will update the list accordingly --> so if I choose tags A and B, it will show me only the tiddlers tagged with A and B ; if I choose the tags A, B and D, it will show me only the tiddlers tagged with A, B and D...

Here is an alternative solution to the question discussed in this thread: 

<$list filter="[[$:/temp/tagsforfiltering]indexes[]][[Operator Examples]][[all Operator]][[About]]">
<$checkbox tiddler="$:/temp/tagsforfiltering" index=<
<currentTiddler>> checked=<<currentTiddler>> unchecked=""> <<currentTiddler>></$checkbox>
</$list>


<$button>
<$wikify name="searchterm" text='[<$list filter="[[$:/temp/tagsforfiltering]indexes[]]"><$list filter="[[$:/temp/tagsforfiltering]getindex
<currentTiddler>]" variable="tagfound">tag[<<tagfound>>]</$list></$list>]'>
<$action-setfield $tiddler="$:/temp/advancedsearchtagfilter" text=<
<searchterm>>/>
Search
</$wikify>
<$wikify name="tagsforfiltering" text='Tiddlers tagged<$list filter="[[$:/temp/tagsforfiltering]indexes[]]"><$list filter="[[$:/temp/tagsforfiltering]getindex
<currentTiddler>]" variable="tagfound">  "<<tagfound>>"</$list></$list>: '>
<$action-setfield $tiddler="$:/temp/advancedsearchtagfilter" tagsforfiltering=<
<tagsforfiltering>>/>
</$wikify>
</$button>
<$button>
<$action-deletetiddler $tiddler="$:/temp/tagsforfiltering"/>
<$action-deletetiddler $tiddler="$:/temp/advancedsearchtagfilter"/>
Reset
</$button>


<$reveal type="nomatch" state="$:/temp/advancedsearchtagfilter" text="[]">
{{$:/temp/advancedsearchtagfilter!!tagsforfiltering}}
<$list filter={{$:/temp/advancedsearchtagfilter}} template="$:/core/ui/ListItemTemplate"/>
</$reveal>
<$reveal type="match" state="$:/temp/advancedsearchtagfilter" text="[]">
No tags selected.</$reveal>

All tags from the filter definition in the first line will be displayed together with checkboxes. The filter can be modified freely, but please keep the first part, [[$:/temp/tagsforfiltering]indexes[]] in place. Please note that you always need to hit "Reset" after modifying the filter definition in the tiddler.

Please feel free to test and report any bugs!

Cheers,

Stef 

Surya

unread,
Feb 17, 2018, 3:56:13 PM2/17/18
to tiddl...@googlegroups.com
Cheers Stef :-))

Yes yes yes :-))

With that (modified) I got now 90% of my wished MultipleTagSearch fulfilled!

With my modified version I got
  • additional tag-groups with popups with their tags inside
    • for that I needed to remove the "indexes[]]" inside the tag-groups. If I could break something with removing that, please tell me, how I could build expandable tag-groups in another way. Or if I had to insert it somewhere else.
  • a count of how many tiddlers are found
  • an "open all found tiddlers"-button
This is my modified version of your suggestion:
<$reveal type="nomatch" state="$:/state/SampleReveal1" text="show">

<$button set="$:/state/SampleReveal1" setTo="show">Show group A & B</$button>

</$reveal>
<$reveal type="match" state="$:/state/SampleReveal1" text="show">

<$button set="$:/state/SampleReveal1" setTo="hide">Hide group A & B</$button>

<$list filter="[[$:/temp/tagsforfiltering][A]][[B]]">

<$checkbox tiddler="$:/temp/tagsforfiltering" index=<
<currentTiddler>> checked=<<currentTiddler>> unchecked=""> <<currentTiddler>></$checkbox>
</$list>

</$reveal>


<$reveal type="nomatch" state="$:/state/SampleReveal2" text="show">

<$button set="$:/state/SampleReveal2" setTo="show">Show group C</$button>

</$reveal>
<$reveal type="match" state="$:/state/SampleReveal2" text="show">

<$button set="$:/state/SampleReveal2" setTo="hide">Hide group C</$button>

<$list filter="[[$:/temp/tagsforfiltering][C]]">

<$checkbox tiddler="$:/temp/tagsforfiltering" index=<
<currentTiddler>> checked=<<currentTiddler>> unchecked=""> <<currentTiddler>></$checkbox>
</$list>

</$reveal>




<$button>
<$wikify name="searchterm" text='[<$list filter="[[$:/temp/tagsforfiltering]indexes[]]"><$list filter="[[$:/temp/tagsforfiltering]getindex
<currentTiddler>]" variable="tagfound">tag[<<tagfound>>]</$list></$list>]'>

<$action-setfield $tiddler="$:/temp/advancedsearchtagfilter" text=<
<searchterm>>/>
Search
</$wikify>
<$wikify name="tagsforfiltering" text='Tiddlers tagged with<$list filter="[[$:/temp/tagsforfiltering]indexes[]]"><$list filter="[[$:/temp/tagsforfiltering]getindex
<currentTiddler>]" variable="tagfound">  <<tagfound>></$list></$list>: '>

<$action-setfield $tiddler="$:/temp/advancedsearchtagfilter" tagsforfiltering=<
<tagsforfiltering>>/>

</$wikify>
</$button>
<$button>
<$action-deletetiddler $tiddler="$:/temp/tagsforfiltering"/>
<$action-deletetiddler $tiddler="$:/temp/advancedsearchtagfilter"/>
Reset
</$button><br/><br/><br/>


<$button>Open ''ALL found'' Tiddlers
<$list filter={{$:/temp/advancedsearchtagfilter}}>
<$action-navigate $to=<
<currentTiddler>> $scroll=no/>
</$list>
</$button>


Matching Tiddlers:
<$count filter={{$:/temp/advancedsearchtagfilter}} template="$:/core/ui/ListItemTemplate"/>


<$reveal type="nomatch" state="$:/temp/advancedsearchtagfilter" text="[]">
{{$:/temp/advancedsearchtagfilter!!tagsforfiltering}}
<$list filter={{$:/temp/advancedsearchtagfilter}} template="$:/core/ui/ListItemTemplate"/>
</$reveal>
<$reveal type="match" state="$:/temp/advancedsearchtagfilter" text="[]">
No tags selected.</$reveal>



What I couldn't find out, is how to add two other wishes:
  • Add an additional filter to the results: Filter the results by ratings (the ratings are written into a field called rating with the values 1 2 3 4 5)
  • Add an additional filter to the results: Filter the results by prefix of the titles. For example <In this result filter out all titles beginning with "B">
How can I add these additional result-filters?

Thanks a lot for trying to help with my MultipleTagSearch-wish!!
Surya

Surya

unread,
Feb 24, 2018, 8:01:59 PM2/24/18
to TiddlyWiki
Hello again,

I still didn't find a complete solution for my Search/Filter by multiple Tags.

The most important features in this solution made by Stef I still dind't find a solution for:

  • Add an additional filter to the results: Filter the results by ratings (the ratings are written into a field called rating with the values 1 2 3 4 5)
  • Add an additional filter to the results: Filter the results by prefix of the titles. For example <In this result filter out all titles beginning with "B">
Please could you help me with this.
Yes, I am asking similar questions in this thread: https://groups.google.com/forum/#!topic/tiddlywiki/7xAPwhJ0iwo. It is for the same goal, but with a completely different approach. So I think, it is better, to have these in two different threads, because both have completely different approaches.

You can see & play around with both on
I experimented so much with them, but I cannot solve it...
Thanks for your help!
Surya

Surya

unread,
Feb 25, 2018, 1:23:27 PM2/25/18
to TiddlyWiki
Hi,

maybe the additional filter could be possible with the additional criteria, like Mark wrote it in his solution?
But I couldn't manage to put it in the right place of Stef's solution, to bring it to work.
Here is the full command from Mark's search-solution by multiple tags with an additional filter (already modified by me to have the choosable tags shown in expandable groups, to have a count and to show the choosen tags as their tag-labels):

\define addPrefix() +[tag[
\define addSuffix() ]]
\define finalFilter()  [all[tiddlers]] $(myfilter2)$ +[regexp[$(additionalCriteria)$]]


<$macrocall
    $name
="toc-tabbed-internal-nav"
    tag
="TableOfContents"
    selectedTiddler
="$:/temp/toc/selectedTiddler"
    unselectedText
="<p>Select a topic in the table of contents. Click the arrow to expand a topic.</p>"
    missingText
="<p>Missing tiddler.</p>"
template="CheckboxTemplate"
/>
<$edit-text tiddler=additionalCriteria tag=input size=20 /><p/>
<$vars additionalCriteria={{additionalCriteria}}>

<$set filter="[field:criteria[yes]addprefix<addPrefix>addsuffix<addSuffix>]" name=myfilter>

<$wikify text=<<myfilter>> name=myfilter2 type=text>

Choosed Tags: <$list filter="[field:criteria[yes]]" storyview="pop"><$set name="backgroundColor" value={{!!color}}><span style=<<tag-pill-styles>> class="tc-tag-label">
<$view field="title" format="text" />
<$button message="tm-remove-tag" param={{!!title}} class="tc-btn-invisible tc-remove-tag-button">&times;</$button></span>
</$set>
</
$list>
 
<div style="display:inline;"><<show-system>></div>



<$button>Open ''ALL found'' Tiddlers
<$list filter=<<finalFilter>>>

<$action-navigate $to=<<currentTiddler>> $scroll=no/>
</$list>
</
$button>

<$count filter=<<finalFilter>> /> matching tiddler:

<$macrocall $name=list-links filter=<<finalFilter>> /
>

</$wikify>
</
$set>
</$vars>

Greetings,
Surya

Surya

unread,
Feb 25, 2018, 1:26:54 PM2/25/18
to TiddlyWiki
Äh, sorry, I wrote something wrong:
My modified version isn't with expandable tag-groups. That's the issue, I cannot solve in Mark's version...
So, the right post now is:


Hi,

maybe the additional filter could be possible with the additional criteria, like Mark wrote it in his solution?
But I couldn't manage to put it in the right place of Stef's solution, to bring it to work.
Here is the full command from Mark's search-solution by multiple tags with an additional filter (already modified by me to have a count and to show the choosen tags as their tag-labels):

Anna Underhill

unread,
Mar 22, 2020, 10:51:52 PM3/22/20
to TiddlyWiki
Hi,

I am NOT a programmer but have created a fabulous TiddlyWiki for my hobby.  I have used the  

MultipleTagSearch by Stef   

http://suryas-testwiki.tiddlyspot.com/  to create a nice search feature.  The "New Character" list is showing a long list of tags [correctly and entered individually].  BUT as my list is quite long [about 200 items] would like to be able to indent some of the items ie Left Align Item A, Left Align Item B, Indent Item C, Left Align Item D etc. 
Reply all
Reply to author
Forward
0 new messages