final MessageManager mailbox = getSelectedMailbox(session);
final SearchQuery query = toQuery(searchKey, session);
MailboxSession msession = ImapSessionUtils.getMailboxSession(session);
final Iterator<Long> it = mailbox.search(query, msession);
final Collection<Long> results = new TreeSet<Long>();
final Collection<Long> uids = new TreeSet<Long>();
while (it.hasNext()) {