Query to identify pages within hierarchies

It is difficult construct a query to identify pages within a hierarchy. For example, if I have the page [[CategoryX/CategoryY/Meeting]] and [[CategoryP/CategoryQ/Meeting]] I cannot identify the meeting pages via the following query:

{{query [[meeting]]}}

The only way to do this is

{{query “/Meeting”}}

i.e. a full text search. This works but is not superflexible, e.g. I can’t manage to combine it with “and”.

I’m far too new to profess any expertise, but a variation of the following advanced query may help:

#+BEGIN_QUERY
{:query [:find (pull ?b [*])
         :in $ ?s
         :where
         [?b :block/marker "TODO"]
         [?b :block/page ?p]
         [?p :block/original-name ?n]
         [(clojure.string/starts-with? ?n ?s)]]
 :inputs [ "projectX/projectY" ]
 }
#+END_QUERY

e.g. :block/marker "TODO" could be replaced with any field from page data, including :block/name "meeting"

More examples here: https://mschmidtkorth.github.io/logseq-msk-docs/#/page/queries%2Fadvanced%20queries%2Ftutorial

Thanks. I wasn’t aware of that website which looks extremely useful. I am still not sure how to search for a page within a hierarchy, though…