Advanced query for pages with a tag

I’m trying to make an inbox page for unsorted items. All I would want here is an advanced query for all pages with the #inbox tag. I tried the template in the official docs (see below), however, the query returns 0 results. What is wrong here?

The official docs offer this template (albeit for the “programming” tag):

#+BEGIN_QUERY
{
:query [:find ?name
       :in $ ?tag
       :where
       [?t :block/name ?tag]
       [?p :block/tags ?t]
       [?p :block/name ?name]]
 :inputs ["inbox"]
}
#+END_QUERY

Might be relevant: the tag in question is #inbox, but this is an alias for a page [[:inbox_tray: Inbox]].

This will pull all the pages that have #inbox in their properties definition (tags:: #inbox).

#+BEGIN_QUERY
  {:title [:h6 "Pages tagged #inbox"]
   :query [:find (pull ?h [*])
           :in $ ?target
           :where
           [?h :block/page ?bp]
           [?bp :page/properties ?pp]
           [(get ?pp :tags) ?t]
           [(get ?t ?target)]] 
   :inputs ["inbox"]
   :table-view? false}
#+END_QUERY

This will pull all the blocks that are tagged with #inbox.

#+BEGIN_QUERY
  {:title [:h6 "Blocks tagged #inbox"]
   :query [:find (pull ?h [*])
           :in $ ?target
           :where
           [?p :block/name ?target]
           [?h :block/refs ?p]] 
   :inputs ["inbox"]
   :table-view? false}
 #+END_QUERY

An interesting gotcha with the first query is that [(contains? ?t ?target)] will fail to return true, even if the page has the tag we are looking for. ?t yields a Set and apparently the way to confirm that some tag exists is by going through its hash: we get an exact match or the function call returns nil, which is evaluated as either true or false in Datomic as it seems. (Gotcha Reference)

On a side note: What keeps trowing me off is that I cannot specify a more complex predicate, or fetch condition, for the tag I’m querying. For instance, I would like to match some tag if my ?target is a substring of that tag or if the tag begins with or ends with it.

For example, instead of [(get ?t ?target)], I would expect to somehow be able to match a page property tag with [(some #(str/includes? % ?target) ?t) _] or [(some #(str/starts-with? % ?target) ?t) _].

Perhaps someone else can help out here?