SearchResult result = new SearchResult(); IndexReader indexReader = null; try { if (!mIndexPath.exists()) { return result; } indexReader = IndexReader.open(mIndexPath); summarize(result, indexReader); if (queryText == null || queryText.length() == 0) { list0(result, indexReader, offset, limit); } else { search0(result, indexReader, queryText, offset, limit); } } catch (Exception e) { throw ServiceException.FAILURE("exception occurred searching mail queue", e); } finally { if (indexReader != null) { try { indexReader.close(); } catch  (IOException ioe) { ZimbraLog.rmgmt.warn("exception occured closing index reader from search", ioe); }
Query query = null; if (queryText != null && queryText.length() > 0) { try { query = QueryParser.parse(queryText, "id", new StandardAnalyzer()); } catch (ParseException pe) { throw ServiceException.FAILURE("bad query", pe);
    public SearchResult search(String queryText, int offset, int limit) throws ServiceException {        SearchResult result = new SearchResult();        IndexReader indexReader = null;        try {        	if (!mIndexPath.exists()) {        		return result;        	}            indexReader = IndexReader.open(mIndexPath);            summarize(result, indexReader);            if (queryText == null || queryText.length() == 0) {            	list0(result, indexReader, offset, limit);            } else {            	search0(result, indexReader, queryText, offset, limit);            }        } catch (Exception e) {            throw ServiceException.FAILURE("exception occurred searching mail queue", e);        } finally {            if (indexReader != null) {                try {                    indexReader.close();                } catch  (IOException ioe) {                    ZimbraLog.rmgmt.warn("exception occured closing index reader from search", ioe);                }            }        }        return result;    }