Exclude second hierarchy notes from search results

Hi there, I searched the web and documentation but wasn’t able to find a solution. I would like to create a search where second (and so on) hierarchy item notes are excluded from search results. Example:

  • List item hierarchy 1 @tag
    ** List item hierarchy 2

Now I do not want List item hierarchy 2 to show up when searching for @tag. Any ideas?

It can be easy, but I am not sure if you ONLY want to exclude hierarchy notes but allow tasks and projects. Anyway, try this,

@tag///* except @tag//@type note

In the documentation, you read about Axis and the simple ones are the following

"children /, descendants //, or descendant-or-self /// axis"

So, with the following,

@tag///*

You are getting all of the items tagged with @tag and its “descendant-or-self”, but when you add,

except @tag//@type note

You are excluding the descendants that are “notes”. Just be aware that if you notes happen to have other children that are not notes those notes will logically appear since TaskPaper by default shows you the inheritance. If you want to go nuclear and do not show any notes under your tag regardless of whether they have a child(s) that is a task or project, use the axis to stop those.

@tag//* except @tag//@type note///*

1 Like