Option to disable query block grouping for specific queries

In Logseq we could add a :result-transform to queries to remove the default group by page.
In many situations this was undesired behaviour, but in others it was exactly what was intended.
In Logseq 0.9.2 this was fixed and the default group by page is now displayed regardless of the use of :result-transform.

This is nice! But it would also be nice to have the option to disable this grouping behaviour for people who were using the :result-transform to remove it.

For example if I have several tasks across pages and I want to sort those tasks in a specific order regardless of what page they are on, this is no longer possible.
I would use :result-transform (fn [result] (sort-by (fn [r] (get r :block/deadline)) result )) for this.
Now it will do the sorting, but on a per page basis.

To illustrate, same query on 2 versions.
From version 0.8.17 on my phone:

From version 0.9.2 on my pc:
Schermafbeelding 2023-04-13 121725

Is such an option now available? Or could it be made available?
Could be an option for the :view clause?
Thanks!

Actually the sorting doesn’t work.
There’s a Github issue. For me the page just has the blocks in the “correct” order.

1 Like

Will fix this.

Hi, is this solved now? It’s still not working for me. In this below example, my results are still grouped by page:

   {:title         "🔥 OVERDUE"
    :query         [:find (pull ?b [*])
                    :in $ ?start ?next
                    :where
                    [?b :block/marker ?marker]
                    (or [?b :block/scheduled ?d]
                        [?b :block/deadline ?d])
                    [(contains? #{"TODO" "DOING" "NOW" "LATER" "WAITING"} ?marker)]
                    [(>= ?d ?start)]
                    [(<= ?d ?next)]]
    :inputs [:365d :today]
    :result-transform (fn [result]
                        (sort-by (fn [h]
                                   (get h :block/priority "Z")) result))
    :collapsed? false
    :breadcrumb-show? false
    :group-by-page? false
    }

Or I guess I need to wait for the next release? I wish there was a web app version of Logseq so that I didn’t have to wait for new releases!!

Nevermind - I updated to 0.9.3 and the problem is now solved! Thank you @Siferiax :pray:

1 Like

When I set “:group-by-page? true” it appears the sort is not applied? I don’t know enough to know if that was the intended function or not :smiley:

If I understand correctly, it will show the blocks as put on the page, or it is random. Not sure.
Either way it is the same behaviour as it already was when :result-transform was not applied.
We now have the option to group results even when :result-transform is applied, which is neat!
But would be nice if a sort is still applied per group or whatever.

From applying the new option to a bunch of my test queries, it works like a charm so far!