protected Element putHits(ZimbraSoapContext zc, Element response, ResultsPager pager, boolean includeMailbox, SearchParams params)
protected Element putHits(ZimbraSoapContext zsc, Element response, ResultsPager pager, boolean includeMailbox, SearchParams params)
    protected Element putHits(ZimbraSoapContext zc, Element response, ResultsPager pager, boolean includeMailbox, SearchParams params)    throws ServiceException {        int offset = params.getOffset();        int limit  = params.getLimit();        EmailElementCache eecache = new EmailElementCache();        if (mLog.isDebugEnabled())            mLog.debug("Search results beginning with offset "+offset);        int totalNumHits = 0;        for (ZimbraHit hit : pager.getHits()) {//          for (ZimbraHit hit = results.skipToHit(offset); hit != null; hit = results.getNext()) {            if (++totalNumHits > limit) {                if (mLog.isDebugEnabled()) {                    mLog.debug("Search results limited to " + limit + " hits.");                }                break;            }            boolean inline = (totalNumHits == 1 && params.getFetchFirst());            boolean addSortField = true;            Element e = null;            if (hit instanceof ConversationHit) {                ConversationHit ch = (ConversationHit) hit;                e = addConversationHit(zc, response, ch, eecache, params);            } else if (hit instanceof MessageHit) {                MessageHit mh = (MessageHit) hit;                e = addMessageHit(zc, response, mh, eecache, inline, params);            } else if (hit instanceof MessagePartHit) {                MessagePartHit mph = (MessagePartHit) hit;                e = addMessagePartHit(response, mph, eecache);                            } else if (hit instanceof ContactHit) {                ContactHit ch = (ContactHit) hit;                e = ToXML.encodeContact(response, zc, ch.getContact(), null, !inline, null);            } else if (hit instanceof NoteHit) {                NoteHit nh = (NoteHit) hit;                e = ToXML.encodeNote(response,zc, nh.getNote());            } else if (hit instanceof ProxiedHit) {                ProxiedHit ph = (ProxiedHit) hit;                response.addElement(ph.getElement().detach());                addSortField = false;            } else if (hit instanceof AppointmentHit) {                AppointmentHit ah = (AppointmentHit)hit;                e = addAppointmentHit(zc, response, ah, inline, params);            } else if (hit instanceof DocumentHit) {                DocumentHit dh = (DocumentHit)hit;                e = addDocumentHit(zc, response, dh);            } else {                mLog.error("Got an unknown hit type putting search hits: "+hit);                continue;            }            if (e != null && addSortField) {                e.addAttribute(MailService.A_SORT_FIELD, hit.getSortField(pager.getSortOrder()).toString());            }            if (e != null && includeMailbox) {//              String idStr = hit.getMailboxIdStr() + "/" + hit.getItemId();                ItemId iid = new ItemId(hit.getAcctIdStr(), hit.getItemId());                e.addAttribute(MailService.A_ID, iid.toString());            }        }        response.addAttribute(MailService.A_QUERY_MORE, pager.hasNext());        return response;    }