Sorting a query by block order on page?

I have a query that simply returns all the blocks on the current page:

#+BEGIN_QUERY
{:query
 [:find (pull ?b [*])
 :in $ ?current-page
 :where
 [?p :block/name ?current-page]
 [?b :block/page ?p]
 ]
 :inputs [:current-page]
}
#+END_QUERY

Is it possible to sort the result by the order that the blocks appear on the page? Created-time is a decent proxy but is not ideal.

3 Likes

@rob this is a great question I really wish to know the answer to as well.
I posted it also on discord and have an ongoing discussion there. I am hoping something will come out of it.

1 Like

I also created the following GitHub issue: Results of queries shows blocks in page out of order · Issue #7833 · logseq/logseq · GitHub

1 Like