Advanced queries and the database documentation?

Logseq simple queries are intended for those not comfortable in datascript/datalog/datomic language. I collect examples of powerful simple queries for future usage:

  • Find all blocks referencing the page: [[Logseq]], #Logseq or tags:: Logseq.
    {{query [[Logseq]]}}
  • Find all pages with page tags tags:: book .
    {{query (page-tags book)}}
  • Find all pages with both page tags logseq & queries.
    {{query (and (page-tags logseq) (page-tags queries))}}
  • Find all pages with page tags logseq or queries
    {{query (page-tags logseq queries)}}
  • Find all Todo blocks doing or now
    {{query (todo doing now)}}
  • Find Todo blocks done in last 7 days.
    {{query (and (todo done) (between -7d today))}}
  • Find all Todo/Doing Now/Later blocks in current page.
    {{query (and (todo todo doing now later) (page <% current page %>))}}
  • Find all Todo/Doing Now/Later blocks where tiensonqin was tagged.
    {{query (and (todo todo doing now later) [[tiensonqin]]) }}
11 Likes