Search with line: AND tag:

I’m trying to aggregate tagged checklists in order to create a general task list. I’m using queries (and search) with the following.
line:"[ ]" tag:#today

Running this will return results twice, once for [ ] and another for #today, which is incorrect. The only way I managed to get this to work properly is running a regex, but that doesn’t take advantage of tag’s cache function. Is this working as intended or am I just using it tag: and line: wrong?

You should be able to do:
line:(query #sometag)
or similar.

Regex helps pick up entire lines that include a specific tag:
line:(/(- \[ \]).*(#tag).*/)

Vantage is a plugin designed to help create complex searches like these.

1 Like

Hi @usaradark,
I had the same problem.

e.g. this line:

  • [ ] Line 1: as asfasdf asdf asd fas df asdf asd fa sdf asd fasd f asdf asd fasd fasd f asdf sdf asdf asd f #tag1 asd fasd fa sdf asdf asd fas dfas df as fasd fasd fas df asd fasd fasd fasd fs #tag2

if you do the search query “line:(/- [ ]/ #tag1 #tag2)”, you will get 3 hits.

After some try and error I found the following solution:
“line:(/- [ ].*/ #tag1 #tag2)” returns only 1 hit.

I don’t know why, perhaps someone knows the reason?


** Edit ** the reason why I don’t want to include the tags into the regex is, that you would have to keep track of the correct ordering if you use more than one tag in a line. With the combination of regex and tags fulltext search you can have many tags in any order and search will find it.

1 Like