Post processing queries to acheive better sorting

The way I see it, the biggest issue is that using :result-transform in advanced queries overrides the default query output. Sometimes this is a good thing and what the end-user may want. Especially when combined with a :view.

For me there are two main issues.

  • Blocks not staying in the same order when no sorting is applied (Sorting a query by block order on page?)
  • No way to keep the formatting for block output when only wanting to sort the result a certain way
    For the most part I’ve been able to write queries in a way that give me the (sorting) results I want.

Your suggestion about using the files isn’t really an option. Lots of Logseq’s rendering isn’t saved into files.
As you already pointed out, many properties are not in those files, but something Logseq manages in it’s in-memory database.
As for writing a query on a page. Same problem. The query just gets put in plain text in the file, the output is rendered whenever you open that page in Logseq itself.

The way forward is probably the query builder I’ve heard mention of, as well as something to be done about making formatting the query output easier. For example making changes to the :result-transform would add those on top of the default instead of completely overriding them. When they need to be overridden a specific command could be used for that. I think that alone would help a lot.

1 Like