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”

Thanks!

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

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

 #+BEGIN_QUERY
{:title [:b "Paper properties"]
 :query [:find (pull ?p [*])
         :where
         [?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")]
  ]}
#+END_QUERY

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

1 Like

It’s very clear and inspiring.

I want to find all the “blocks with certain prpoerty”.
For example, each paper takes a page; in the page, some blocks has certain block-property.
And I want to write some code at the beginning of each page, to display all the blocks with block-properties, so that I can recall what this paper is about with a galance.

Thank you for you time! and I understand this will be very complex and might not be achieveable. Thank you all the same~