Open joostvanzwieten opened 6 months ago
I think I found the culprit. In crates/store/src/query/sort.rs
method Store::sort
there are three variants for sorting messages. The first applies to a single comparator and without collapsed threads, the second to multiple comparators and the last to the remainder (including a single comparator and collapsed threads). The third variant doesn't sort the messages. My problem is solved by using the second variant also for a single comparator, thus changing line 137 to
} else if comparators.len() >= 1 {
I've briefly investigated adding support for filtering out duplicate prefixes in the first variant, but this requires async closures, which Store::iterate
doesn't support.
Thanks, this is going to be reviewed once the webadmin is released.
What happened?
I've been trying out the JMAP interface of the mail server and noticed that
sort
of theEmail/query
method doesn't do anything in combination withcollapseThreads=true
. Sorting works as expected without collapsing the threads. I've also tried Ltt.rs and noticed that the emails are displayed in insertion order, not by date, despite Ltt.rs requesting threads sorted onreceivedAt
.How can we reproduce the problem?
To reproduce, you can try the following query (with appropriate
accountId
):For me this query returns the emails in insertion order, both with ascending and descending order. Setting
collapseThreads
tofalse
gives the expected order.Version
v0.5.x
What database are you using?
RocksDB
What blob storage are you using?
Filesystem
Where is your directory located?
Internal
What operating system are you using?
Linux
Relevant log output
No response
Code of Conduct