On 2 Oct 2018, at 12.22, Alessio Cecchi <ales...@skye.it> wrote:
>
> Hello,
>
> we are developing a library to show last arrived messages of all threads in a
> folder with more than 300k messages.
>
> 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.
>
It sounds like what you want is REFS threading, which Dovecot supports, but it
didn't make it into official RFC:
https://tools.ietf.org/html/draft-gulbrandsen-imap-inthread-05
<https://tools.ietf.org/html/draft-gulbrandsen-imap-inthread-05>