Sorting by priority with simple query

I have this simple query “{{query (and (todo todo doing) [[Momolingo]])}}” which gets all my TODOs for a project. I see there’s a “sort-by” for simple queries:

https://logseq.github.io/#/page/61c1f5ab-2a06-408d-b28d-3a90de859288

But don’t see how to make this sort by priority which seem to just be tags. BTW, anyway to have drag-and-drop functionality for prioritizing todos? Some kind of property could be added to the blocks that changes when their drag position is changed I suppose.

2 Likes

Was able to combine simple and advanced queries this way:

#+BEGIN_QUERY
{:title "🔨 All todos with current pages tag"
 :query (and (todo TODO DOING) [[Momolingo]])
:result-transform (fn [result]
                                 (sort-by (fn [h]
                                                  (get h :block/priority "Z")) result))
}
#+END_QUERY
2 Likes