Search by excluding tags

I’m trying to filter my taskpaper file by focusing on a single project in the sidebar and excluding two tags. I can’t figure out why this is not working:

not @drop or not @passed

not (@drop or @passed)

I even tried:

(project name of project//*) except //@drop

The last one doesn’t even work if I only exclude one single tag.

“not” searches can be tricky to get right in TaskPaper because the ancestors of search result are always included along with the search results. A little better explanation is in this post:

I expect what’s happening is that you have something like this:

hello world @drop
    child of hello world

And when you search for not @drop you see the two above items in the results. The reason is that “child of hello world” is matching not @drop … and then “hello world @drop” is inserted into the results since it’s an ancestor.

You can work around this using except. For example here’s the official not @done search:

not @done except @done//*

It first finds all items that are not @done. It then removes from those results the descendants from all items that ARE @done. I think you can use this same pattern to get the results you want.

Greetings:
One of my TaskPaper files uses an ‘@whenever’ tag, as well as the ‘@done’ tag.
A ‘not done’ search using the technique described in this post (‘not @done except @done//') works.
A ‘not whenever’ search using a similar syntax ('not @whenever except @whenever//
’) also works.
However, when I try to combine them to hide items tagged with @done or @whenever using ‘not @whenever except @whenever//* or not @done except @done//', the first half of the search works, but not the second. In other words, if I have ‘not @whenever’ come first in the search using 'not @whenever except @whenever// or not @done except @done//', then items tagged with @whenever do not show, but items tagged @done do show; however, if I switch the order and have ‘not @done’ come first using 'not @done except @done// or not @whenever except @whenever//*’, then items tagged as @done do not show, but items tagged with ‘@whenever’ do show.

It does not seem to matter whether I use ‘and’ or ‘or’ in the search string. If I try to hide items tagged with @done or @whenever using ‘not @whenever except @whenever//* and not @done except @done//', the first half of the search still works, but not the second. In other words, if I have ‘not @whenever’ come first in the search using 'not @whenever except @whenever// and not @done except @done//', then items tagged with @whenever do not show, but items tagged @done do show; however, if I switch the order and have ‘not @done’ come first using 'not @done except @done// and not @whenever except @whenever//*’, then items tagged as @done do not show, but items tagged with ‘@whenever’ still show.

Clearly, I need some help with figuring out the syntax for a ‘compound double two part’ search :sunglasses:

I “think” what you want is:

not (@done or @whenever) except (@done or @whenever)//*

Jesse: That seems to do exactly what I want. Thank you very much for your incredibly rapid and very helpful reply!

1 Like