Search for tag and free-text nested anywhere

I have been trying for days to achieve this without succeeding.
I want to query for all blocks with a certain tag (e.g. #identity) and free-text (e.g. “this can be summarised”).
I would like the query to return something for blocks with this structure:

Top Level Title #identity #more_tags

  • some text
    • more text
    • this can be summarised as follows:
      • more text

I have tried block/tag in combination with clojure free text search but I cannot get it to work. I was wondering if someone has the answer?

Here is one way:

#+BEGIN_QUERY
{:title "Team Listing"
 :query [:find (pull ?b [*])
   :where
     [?b :block/path-refs ?ref]
     [?ref :block/name "identity"]
     [?b :block/content ?content]
     [(clojure.string/includes? ?content "this can be summarised")]
 ]
}
#+END_QUERY
1 Like

Thank you very much! Works like a charm :grinning: