Help with a 'simple' advanced query (searching for block with multiple tags)

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.

Welcome.

  • What you posted works normally to me.
    • I get all 3 results.
  • Try removing some conditions, until you get some results.
    • Based on which condition’s addition causes the results to become empty, we may be able to make a guess.
  • Open the file in an external markdown editor.
    • There may be something invisible that may affect how Logseq perceives the tasks.
  • Start over, one step at a time.
    • New empty graph.
      • Preferably without plugins or other customizations.
    • Copy there the data not from the old graph, but from your post here.

Thank you - that really helped - in the sense that it motivated me to continue trying… :wink: 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

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:

  • Block with #MyTag
    • TODO block without a tag

: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.