Search in sources :

Example 31 with ZSearchParams

use of com.zimbra.client.ZSearchParams in project zm-mailbox by Zimbra.

the class TestUtil method search.

public static List<String> search(ZMailbox mbox, String query, String type) throws ServiceException {
    List<String> ids = new ArrayList<String>();
    ZSearchParams params = new ZSearchParams(query);
    params.setTypes(type);
    for (ZSearchHit hit : mbox.search(params).getHits()) {
        ids.add(hit.getId());
    }
    return ids;
}
Also used : ZSearchHit(com.zimbra.client.ZSearchHit) ZSearchParams(com.zimbra.client.ZSearchParams) ArrayList(java.util.ArrayList)

Aggregations

ZSearchParams (com.zimbra.client.ZSearchParams)31 Test (org.junit.Test)21 ZSearchResult (com.zimbra.client.ZSearchResult)17 ArrayList (java.util.ArrayList)12 ZMailbox (com.zimbra.client.ZMailbox)11 ZSearchHit (com.zimbra.client.ZSearchHit)9 ServiceException (com.zimbra.common.service.ServiceException)9 Mailbox (com.zimbra.cs.mailbox.Mailbox)9 Message (com.zimbra.cs.mailbox.Message)9 ZMessage (com.zimbra.client.ZMessage)5 Cursor (com.zimbra.client.ZSearchParams.Cursor)4 ParsedMessage (com.zimbra.cs.mime.ParsedMessage)2 SearchSortBy (com.zimbra.soap.type.SearchSortBy)2 ZMessageHit (com.zimbra.client.ZMessageHit)1 ZSearchPagerResult (com.zimbra.client.ZSearchPagerResult)1 SoapFaultException (com.zimbra.common.soap.SoapFaultException)1 Account (com.zimbra.cs.account.Account)1 Date (java.util.Date)1