Alternatively if you want to add it through the inputs, add an extra input as per the double tags example and use that input instead of "ongoing" (as in: [(= ?status ?input2)] )
no result if I do this …
#+BEGIN_QUERY
{:title “block tags”
:query [
:find (pull ?b [* ] )
:where
[?zp :block/name “tips”]
[?b :block/tags?zp]
]
}
#+END_QUERY
I got all blocks referring to “tips” if I do this …
#+BEGIN_QUERY
{:title “block tags”
:query [
:find (pull ?b [* ] )
:where
[?zp :block/name “tips”]
[?b :block/refs ?zp]
]
}
#+END_QUERY
[?b :block/tags ?zp] is only available when you use the tags:: property. [?b :block/refs ?zp] works regardless of how you reference the page in the block as long as Logseq sees it as a reference (i.e. it becomes a link)
Thank you, Siferiax
I’m just a beginner for logseq. Since a block can have any # on itself. Why do we need a tag property on a block? What is it for?
We don’t need it. But to clarify tags:: property isn’t the same as using a hashtag (#).
We can use the tags:: property as a page property to tag that page with certain keywords.
In the same way we can add links to other pages with # or [[ ]] (these are only visually distinct.
When using the property we can indicate the type of relationship (in this case tag) instead of just the link.
In terms of queries :block/refs will always get all references (including if they have been specified using tags::) :block/tags on the other hand only gets those references that are specified in the tags:: property.
This would be a case where using that tags:: property can be an advantage if you only want a query to pick up on certain references and not others.