{:title "🎲"
:query [:find (pull ?b [*])
:where
[?b :block/page ?p]
[?b :block/refs ?t]
(or
[?t :block/name "tag1"]
[?t :block/name "tag2"]
)
]
:result-transform ( fn [result] [(rand-nth result)] )
:collapsed? true
}
I rewrote it like so, because
- that’s more readable
- if you didn’t make the tag yet it doesn’t throw an error
- we want the
or
for the tag name and not whether there’s a reference.
Most importantly though we userefs
instead ofpath-refs
.
From: logseq/schema.cljs at master · logseq/logseq · GitHub
;; reference blocks
:block/refs {:db/valueType :db.type/ref
:db/cardinality :db.cardinality/many}
;; referenced pages inherited from the parents
:block/path-refs {:db/valueType :db.type/ref
:db/cardinality :db.cardinality/many}
That said, this still shows the child blocks, but as part of the block result you want.