Shortcuts: `search for notes containing -#tag_name` not working

I just reported this same issue in an old (stale) thread (a Panda bug report that I started in December 2023) and realized that might not have been the right place. So here is the same report.

However I now see a new problem.

search for notes containing #journal

works as expected, but the negative version,

search for notes containing -#journal

a search for notes that are not tagged with “#journal” doesn’t work, it includes those notes.

To be precise,

@last1days
correctly returns 10 notes, of which 3 are journal notes
#journal @last1days
correctly returns the 3 journal notes
-#journal @last1days
incorrectly returns 7 notes. The total is correct but it includes the 3 journal notes and misses 3 non-journal notes.

Note: The additional @lastxdays doesn’t change the essence of the problem, it just limits the number of notes being processed.

Hello,

I’ve been personally investigating the search action bugs since the original post last year and some progress was made but I struggle to reproduce this one.

Are you experiencing this problem on both iOS and macOS?
I’m asking because iOS App extensions like the Bear’s shortcut actions come with a memory limitation and we had to limit query results. This means -#journal can indeed have some issues, but in combination with @lastXdays shouldn’t.

I really appreciate the on-going efforts to solve these issues. I had set this aside after reporting the problems last year but the topic came up again this week with a different shortcut development.

To answer your question, the results are different on iOS and macOS, which I hadn’t realized earlier.

I just ran the search for -#journal @last10days

It works as expected on iOS but fails on macOS for me.

Thanks, Paul

As I reported above, a search in shortcuts on iOS for @last3days -#journal correctly does not return any journal notes, unlike macOS that fails this criteria.

However, on closer inspection, even on iOS the search results aren’t correct.

It is returning valid matches to the search but not all of them.

The in-app search: @last3days -#journal produces 14 notes but the shortcut-based search on iOS only returns 9. These 9 are correct but there are others that have been missed.