if (params.getField() != null) req.addAttribute(MailService.A_FIELD, params.getField());
    private ZSearchResult internalSearch(String convId, ZSearchParams params) throws ServiceException {        XMLElement req = new XMLElement(convId == null ? MailService.SEARCH_REQUEST : MailService.SEARCH_CONV_REQUEST);        req.addAttribute(MailService.A_CONV_ID, convId);        if (params.getLimit() != 0) req.addAttribute(MailService.A_QUERY_LIMIT, params.getLimit());        if (params.getOffset() != 0) req.addAttribute(MailService.A_QUERY_OFFSET, params.getOffset());        if (params.getSortBy() != null) req.addAttribute(MailService.A_SORTBY, params.getSortBy().name());        if (params.getTypes() != null) req.addAttribute(MailService.A_SEARCH_TYPES, params.getTypes());        if (params.getFetch() != null && params.getFetch() != Fetch.none) {            // use "1" for "first" for backward compat until DF is updated            req.addAttribute(MailService.A_FETCH, params.getFetch() == Fetch.first ? "1" : params.getFetch().name());        }        if (params.isPreferHtml()) req.addAttribute(MailService.A_WANT_HTML, params.isPreferHtml());        if (params.isMarkAsRead()) req.addAttribute(MailService.A_MARK_READ, params.isMarkAsRead());        if (params.isRecipientMode()) req.addAttribute(MailService.A_RECIPIENTS, params.isRecipientMode());                req.addElement(MailService.E_QUERY).setText(params.getQuery());                if (params.getCursor() != null) {            Cursor cursor = params.getCursor();            Element cursorEl = req.addElement(MailService.E_CURSOR);            if (cursor.getPreviousId() != null) cursorEl.addAttribute(MailService.A_ID, cursor.getPreviousId());            if (cursor.getPreviousSortValue() != null) cursorEl.addAttribute(MailService.A_SORTVAL, cursor.getPreviousSortValue());        }                return new ZSearchResult(invoke(req));    }