That’s where the issue is; the :block/name
stores the page name in lower case, i.e., MYTAG is stored as mytag. So if you want to use the exact page name in the query, then replace the :block/name
with :block/original-name
.
#+BEGIN_QUERY
{:title "All tasks tagged with MYTAG"
:query [:find (pull ?b [*])
:where
(task ?b #{"NOW" "LATER" "DOING" "TODO"})
[?b :block/page ?p]
[?r :block/original-name "MYTAG"]
(or [?b :block/path-refs ?r]
[?p :block/tags ?r])]}
#+END_QUERY