<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">On 2 Oct 2018, at 12.22, Alessio Cecchi <<a href="mailto:alessio@skye.it" class="">alessio@skye.it</a>> wrote:<br class=""><div><blockquote type="cite" class=""><br class="Apple-interchange-newline"><div class="">
<meta http-equiv="content-type" content="text/html; charset=iso-8859-15" class="">
<div text="#000000" bgcolor="#FFFFFF" class=""><p class="">Hello,<br class="">
<br class="">
we are developing a library to show last arrived messages of all
threads in a folder with more than 300k messages.<br class="">
<br class="">
As per the RFC 5256, the IMAP thread command has only the option
to specify the grouping criteria (REFERENCES vs ORDEREDSUBJECT).
So we implemented an algorithm which gets the full UID SORT
ordered by date in reverse order then gets all thread relations
and then post process all outputs to obtain the final result.<br class=""></p></div></div></blockquote><div>It sounds like what you want is REFS threading, which Dovecot supports, but it didn't make it into official RFC: <a href="https://tools.ietf.org/html/draft-gulbrandsen-imap-inthread-05" class="">https://tools.ietf.org/html/draft-gulbrandsen-imap-inthread-05</a></div></div><br class=""></body></html>