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):
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) _].
As for substrings as mentioned earlier in this topic. Can do so with :block/properties-text-values and clojure.string/starts-with?, clojure.string/ends-with? and clojure.string/includes?.