protected static void putInfo(Element response, ZimbraQueryResults results) { List<QueryInfo> qinfo = results.getResultInfo(); if (qinfo.size() > 0) { Element qinfoElt = response.addElement(MailConstants.E_INFO); for (QueryInfo inf : qinfo) { inf.toXml(qinfoElt); } } }
private void putHits( ZimbraSoapContext zsc, OperationContext octxt, Element el, ZimbraQueryResults results, SearchParams params) throws ServiceException { if (params.getInlineRule() == ExpandResults.HITS) { // "hits" is not a valid value for Search... params.setInlineRule(ExpandResults.NONE); } ResultsPager pager = ResultsPager.create(results, params); if (params.getCursor() != null) { if (params.getCursor().isIncludeOffset()) { long offset = pager.getCursorOffset(); if (offset >= 0) { el.addAttribute(MailConstants.A_QUERY_OFFSET, offset); } } } else { el.addAttribute(MailConstants.A_QUERY_OFFSET, params.getOffset()); } SearchResponse resp = new SearchResponse(zsc, octxt, el, params); resp.setIncludeMailbox(false); resp.setSortOrder(pager.getSortOrder()); while (pager.hasNext() && resp.size() < params.getLimit()) { ZimbraHit hit = pager.getNextHit(); resp.add(hit); } resp.addHasMore(pager.hasNext()); resp.add(results.getResultInfo()); }