Hi, I copy pasted a query from here: https://mschmidtkorth.github.io/logseq-msk-docs/#/page/Queries%2FAdvanced%20Queries%2FTutorial
And setup example data to test it.
This is the query I copied:
#+BEGIN_QUERY
{:title "Find: MyTag and MyOtherTag"
:query [:find (pull ?b [*])
:where
[?b :block/marker ?marker]
[(contains? #{"TODO" "DOING"} ?marker)]
[?b :block/ref-pages ?p]
[?p :block/name ?tag]
[(contains? #{"mytag" "myothertag"} ?tag)]]
}
#+END_QUERY
Screenshot from my logseq, with both the query, and the test data that I expected it to return.
Thank you - that really helped - in the sense that it motivated me to continue trying…
but in all honesty: thanks!
Moving it to a clean graph to not fix it (with all plugins and other customisations turned off).
However, I managed to fix it, I do NOT now understand HOW:
This is what fixed it: lower-case letters only within the tags I am searching for:
![2024-01-31_03-12-18_am](https://discuss.logseq.com/uploads/default/original/2X/e/eef6d2ad7323cf3ea3c2b2b94e5c8760699812c8.jpeg)
I do not now understand how this 'accidentally happened.
When I posted the code here, it changed the tags to lowercase - check my screenshot above, where the tags are camel-backed. So when mentaloid copied it from here it worked, as it did for me this morning.
This shouldn’t be the cause of the issue - the documentation here (https://mschmidtkorth.github.io/logseq-msk-docs/#/page/Queries%2FAdvanced%20Queries%2FTutorial) use capital letters…
Summary
It doesn’t?
Either way, the attribute :block/name
is always in lower case.
Also :ref-pages
is deprecated. Should use either :path-refs
or :refs
.
Where :path-refs
takes ancestors into account:
:path-refs
will return the block TODO block without a tag
. :refs
will not as it only looks at the references present directly in the block itself.