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

Hi, I copy pasted a query from here:

And setup example data to test it.

This is the query I copied:

	{:title "Find: MyTag and MyOtherTag"
	:query [:find (pull ?b [*])

		[?b :block/marker ?marker]
		[(contains? #{"TODO" "DOING"} ?marker)]

		[?b :block/ref-pages ?p]
		[?p :block/name ?tag]
		[(contains? #{"mytag" "myothertag"} ?tag)]]

Screenshot from my logseq, with both the query, and the test data that I expected it to return.


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

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 ( use capital letters…


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.