Help! how to query for pages with certain parts of property

I want to find pages which includes certain property.
for example, I have property “x1” “x2” “x3”
and I want to query for all pages with a property including “x”


There are several functions you can use to query for page properties:

This searches for a page with type:: paper in the meta-data:

{:title [:b "Paper properties"]
 :query [:find (pull ?p [*])
         [?p :block/properties ?prop]   ; save properties of page ?p to ?prop
         [(get ?prop :type) ?t]         ; of all the properties in ?prop, get :type save to ?t
         [(str ?t) ?t2]                 ; convert ?t to string ?t2 (important!)

         ;;you can use either of these, or a combination:
         ;[(= "paper" ?t2)]             ; ?t2 equals "paper"
         ;[(clojure.string/ends-with? ?t "aper")]
         ;[(clojure.string/starts-with? ?t2 "pap")]
         ;[(clojure.string/includes? ?t "ape")]

Comments start with ; just uncomment the parts you want to use

1 Like