How can I filter all tiddlers by list of tags?

I have a field, searchTags that contains a list of tags (e.g. foo bar [[with space]]). How can I use it to return a list of all tiddlers that have all these tags? That is, unlike ‘tagging’ operator, I want an ‘and’ and not ‘or’

This thread is similar. I achieved an AND-based filter here based on Charlie’s hint… but it was not exactly compact or elegant. :grimacing:

I’d welcome anyone who has a better insight. And if there’s nothing currently doing this kind of work, I’d love to see an intuitive solution available for the community…

Not remembering what I did, I decided to build the solution again without looking at the previous one just to see what I’d come up with.

\define a()  [tag[
\define b()  ]]

<$list filter={{{ [enlist{Test!!searchTags}addprefix<a>addsuffix<b>join[ +]] }}}>
    <<currentTiddler>><br>
</$list>

If we want to have the same thing giving OR instead of AND (just change the join operator):

<$list filter={{{ [enlist{Test!!searchTags}addprefix<a>addsuffix<b>join[ ]] }}}>
    <<currentTiddler>><br>
</$list>

Filtering black magic… Thanks!

BTW, this will load all tiddlers, then reduce the list by the first tag, then by the second, then another. Is there a way to make this in one iteration?