Help with search syntax: tags and a project


#1

I’m trying to build a search string that returns both the results of a tag search, as well as the contents of a specific project.

Longer version:

I have a project called “## Shortstack” (the ## are because I want my tp files to work well with my markdown-aware collapsing editor). It’s my small miscellany/@doing substitute for the little things that come up across the day. I also have some tag based searches for stuff to work on today. My file looks like

Shortstack:

- thing I just remembered
- email I just got and have to answer

Project1:

- thing for later
- thing I'm working on @today 

etc.

And what I want to return is

Shortstack:

- thing I just remembered
- email I just got and have to answer

Project1:

- thing I'm working on @today

I tried

! Working @search(@due <=[d] today +24h or @today or project ## Shortstack: except @done)

but this gets me the tagged items, not the shorstack project (but oddly it does return the saved search line for reasons I don’t understand).

I suspect there’s a way to do this with the tp search syntax that I’m not getting. Any ideas?


#2

or enables you to loosen the match conditions at some point of a single search path

but union is what you need to combine the harvests of two separate search paths

Perhaps you are aiming for something like the following ?

@due <=[d] today +24h or @today union project ## Shortstack//(not @done)

or, inside a @search() tag ( which requires grouping parentheses to be escaped with backslashes ):

@search(@due <=[d] today +24h or @today union project ## Shortstack//\(not @done\))

( See the section on set operations [union, intersect, and except] in http://guide.taskpaper.com/formatting_queries.html )


#3

Ah yes! Union! That was the magic word. Thank you so much.

(side note, you have extraneous parenthesis in your example that break the search. I figured out to take them out, but they might confuse other people coming to this thread)


#4

Thanks ! I think you will find that grouping parentheses are not actually extraneous (you can you use them directly in the toolbar search panel),

but the special context inside a @search() tag requires escaping them with backslashes

@search(@due <=[d] today +24h or @today union project ## Shortstack//\(not @done\))

so that they don’t confuse the tag parser.

( for reference: Item 5 under Saved Searches in http://guide.taskpaper.com/making_big_lists_smaller.html )

(And you are quite right, of course, grouping parentheses are not strictly needed there – I personally use them out of habit in case I want to add to the complexity of the filtering at that point)