[tw5] [NOOB] need some help with filters OR instead of AND

Hey Guys
Apologies if this is a duplicate. This could be a simple answer but i have been looking at it for days and still not getting there.
I am using a macro i found on the web called tagfilter ($:/.tb/macros/tagfilter), just had another look and i can’t see where i got it from. Its pretty simple just pick a set of tags and then lookup the pages that match and display the list. I want to modify it so that it just returns the ones that have ALL of the tags picked rather than ANY.
I think the line in the macro that is doing the filter is this

<$list filter="[!is[system]sort[]]+[all[current]tags[]tagging:all[]]+[sort[]]-[all[current]]" template="$template$"/>

I think its the “tagging” part that is picking up pages with ANY of the tags… question is what do i replace it with?

This is the full macro incase i am misleading people on the line that is doing the filter

\define lingo-base() $:/language/EditTemplate/

\define tagfilter(filter:"[!is[system]sort[]]",state:"$:/temp/TagFilter", template:"$:/core/ui/ListItemTemplate")
<$set name=state value="$state$">
<$tiddler tiddler=<>>
<$set name=tags filter="[all[current]tags[]]">
<$set name=“addtags” filter="
$filter$
+[all[current]tags[]tagging:all[]]
-[all[current]]
+[tags[]]
-[all[current]tags[]]">

<$fieldmangler>
<$list filter="[all[current]tags[]sort[title]]" storyview=“pop”>
<<tag mode:“remove”>>
</$list>

<$reveal type=nomatch text="" default=<>>
<$reveal type=match text="" default=<>>
Filter by:
</$reveal>
<$button popup=<<qualify “$:/state/popup/tags-auto-complete”>> class=“tc-btn-invisible tc-btn-dropdown” tooltip={{$:/language/EditTemplate/Tags/Dropdown/Hint}} aria-label={{$:/language/EditTemplate/Tags/Dropdown/Caption}}>{{$:/core/images/new-button}}</$button>
</$reveal>
<$reveal type=match text="" default=<>>
Filter by:
<$button popup=<<qualify “$:/state/popup/tags-auto-complete”>> class=“tc-btn-invisible tc-btn-dropdown” tooltip={{$:/language/EditTemplate/Tags/Dropdown/Hint}} aria-label={{$:/language/EditTemplate/Tags/Dropdown/Caption}}>{{$:/core/images/new-button}}</$button>
</$reveal>

<$reveal state=<> type="nomatch" text="" default="">
<$edit-text tag="input" default="" placeholder="Filter tags" class="tc-edit-texteditor tc-popup-handle" focus="true"/> <$linkcatcher set=<> setTo="" message="tm-add-tag"> <$reveal type=match text="" default=<>> <$list filter="$filter$ +[tags[]!is[system]search{$state$}sort[]]"> <> <$reveal type=nomatch text="" default=<>> <$list filter=" $filter$ +[all[current]tags[]tagging:all[]] +[tags[]!is[system]search{$state$}sort[]] -[all[current]tags[]]"> <>
<$reveal type=match text="" default=<>> <$list filter="$filter$" template="$template$"/> <$reveal type=nomatch text="" default=<>> <$list filter=" $filter$ +[all[current]tags[]tagging:all[]] +[sort[]] -[all[current]]" template="$template$"/> \end

Thanks in advance - Pete

G’day Pete,

Although that stretch of code is too big and complicated for me to wrap my mind around it, I’ve thrown two sample filters into TiddlyWiki.com’s Advanced Search tiddler and did a couple of screen captures (attached), just to show the basics of setting up “and” vs “or”.

Thanks for the hints,
I am understanding more about TW5 and learning, but still no cigar.

I will explain what i am trying to achieve it may make things easier (feels like there will be a pre-canned solution out there). I have added a fair amount of content to a wiki +80 pages, diagrams and tiddlymap all working well, there are common tags that are reused to assist with classification and content. I am was hoping to provide an interactive, easy to use search page that lets the end readers narrow down the pages with a combination of tags, it may take about 3 tags to find the pages you are looking for, but could be more. I understand that i can do this in advance search - just trying to make it easy for others with pulldowns, and no typing…etc.

I feel like i am getting closer, and have found the source of the original macro i used, but still not the result i am looking for, looks like the macro i found and tried to use is too old. (skip the rest of this paragraph if you dont need the detail ). The example tagfilter() i found and tried to implement looks like it was created a while ago as an example by @tobibeer and may not actually have made it into the core (http://tagfilter.tiddlyspot.com/). The online tagfilter shown in the link does filter and work the way i wanted it to with AND logic, however when i have added it to my wiki it works with OR. From reading comments in github it looks like the changes to “tagging” that this macro used were not actually added to core and it was superseded by the “contains:tags” filter logic. I tried adding more of what is listed as dependencies in github for the macro but ended up with lots of javascript errors and crash on startup, (did manage to recover from backup) .

In that old macro, i think this line that filters and displays the list is this one
[all[current]tags[]tagging:all[]]
where it is taking the list of tags that the user has selected (“current” and have been added to a temp page) and finding all the tiddlers that some contain the same tags, where i want it to contain all of the same tags. From reading i need to replace that part with something that includes “contains:” (maybe)

What i am trying to achieve in English is… “How do i find a list of all pages that contain all the tags of the current temp page?”

Once again thanks in advance,
Pete

Just for conversation’s sake, download the attached and drag it into tiddlywiki.com .

Search Tiddlers By Tag.json (1.61 KB)

Thank you so much Charlie!
All working,
I owe you a beer or two!.

if you are ever in Melbourne look me up :slight_smile: (assuming we will get out of our lockdown and current mess sometime soon)

just what i needed.

That makes my day, Pete! Thanks!