It should return only the one MIN/MAX mail's relevancy, not all of them.
Similarly the SEARCHRES $ should be updated only to the MIN/MAX mail, not
all mails.
SEARCH_RETURN_UPDATE = 0x0080,
SEARCH_RETURN_PARTIAL = 0x0100,
SEARCH_RETURN_RELEVANCY = 0x0200
-/* Options that don't return any seq/uid results */
+/* Options that don't return any seq/uid results, and also don't affect
+ SEARCHRES $ when combined with MIN/MAX. */
#define SEARCH_RETURN_NORESULTS \
(SEARCH_RETURN_ESEARCH | SEARCH_RETURN_MODSEQ | SEARCH_RETURN_SAVE | \
- SEARCH_RETURN_UPDATE)
+ SEARCH_RETURN_UPDATE | SEARCH_RETURN_RELEVANCY)
};
struct imap_search_context {