queryParser.setLowercaseExpandedTerms(false);//some add. fields are not tokenized and not lowered case
Query query = queryParser.parse(queryString);
try {
query = searcher.rewrite(query);
} catch (Exception ex) {
throw new QueryException("Rewrite-Exception query because too many clauses. Query=" + query);
}
long startTime = System.currentTimeMillis();
int n = SearchServiceImpl.getInstance().getSearchModuleConfig().getMaxHits() + 1;
TopDocs docs = searcher.search(query, n);
long queryTime = System.currentTimeMillis() - startTime;
if (log.isDebug()) log.debug("hits.length()=" + docs.totalHits);
SearchResultsImpl searchResult = new SearchResultsImpl(searcher, docs, query, analyzer, identity, roles, doHighlighting);
searchResult.setQueryTime(queryTime);
searchResult.setNumberOfIndexDocuments(searcher.maxDoc());
queryCount++;
return searchResult;
} catch (ServiceNotAvailableException naex) {
// pass exception
throw new ServiceNotAvailableException(naex.getMessage());
} catch (ParseException pex) {
throw new ParseException("can not parse query=" + queryString);
} catch (QueryException qex) {
throw new QueryException(qex.getMessage());
} catch (Exception ex) {
log.warn("Exception in search", ex);
throw new ServiceNotAvailableException(ex.getMessage());
}
}