* @throws CRException
*/
@Override
public final Collection<CRResolvableBean> getObjects(final CRRequest request, final boolean doNavigation)
throws CRException {
UseCase ucGetObjects = startUseCase("LuceneRequestProcessor." + "getObjects(" + name + ")");
/**
* search preparations (instantiate/validate all needed variables)
*/
UseCase ucPrepareSearch = startUseCase("LuceneRequestProcessor.getObjects(" + name + ")#prepareSearch");
ArrayList<CRResolvableBean> result = new ArrayList<CRResolvableBean>();
int count = getCount(request);
int start = getStart(request);
ucPrepareSearch.stop();
/** * search preparations */
/**
* Get results
*/
long indexSearchStartTime = System.currentTimeMillis();
UseCase ucSearch = startUseCase("LuceneRequestProcessor." + "getObjects(" + name + ")#search");
HashMap<String, Object> searchResult = null;
try {
searchResult = searcher.search(
request.getRequestFilter(),
getSearchedAttributes(),
count,
start,
doNavigation,
request.getSortArray(),
request);
} catch (IOException ex) {
LOGGER.error("Error while getting search results from index.");
throw new CRException(ex);
}
ucSearch.stop();
LOGGER.debug("Search in Index took " + (System.currentTimeMillis() - indexSearchStartTime) + "ms");
/**
* process search
*/
UseCase ucProcessSearch = startUseCase("LuceneRequestProcessor." + "getObjects(" + name + ")#processSearch");
if (searchResult != null) {
Query parsedQuery = (Query) searchResult.get(CRSearcher.RESULT_QUERY_KEY);
result = processMetaData(result, searchResult, parsedQuery, request, start, count);
result = processSearchResolvables(result, searchResult, parsedQuery, request);
} else {
// searchresult is null - we don't want to proceed - we want to throw an error
result = null;
}
ucProcessSearch.stop();
/** * process search */
ucGetObjects.stop();
return result;
}