use of org.hippoecm.hst.content.beans.query.exceptions.QueryException in project hippo by NHS-digital-website.
the class BloomreachSearchProvider method getBloomreachResults.
public Pageable<HippoBean> getBloomreachResults(String queryString, int pageSize, int currentPage, SearchArea searchArea) {
HstQuery query = getQuery(queryString, searchArea);
query.setLimit(pageSize);
query.setOffset((currentPage - 1) * pageSize);
if (queryString == null) {
query.addOrderByDescending("hippostdpubwf:lastModificationDate");
}
try {
final HstQueryResult execute = query.execute();
return pageableFactory.createPageable(execute.getHippoBeans(), execute.getTotalSize(), pageSize, currentPage);
} catch (QueryException e) {
LOG.error("Error running query: {}", e.getMessage());
LOG.debug("Query exception: ", e);
return null;
}
}
use of org.hippoecm.hst.content.beans.query.exceptions.QueryException in project hippo by NHS-digital-website.
the class FolderComponent method doBeforeRender.
@Override
public void doBeforeRender(final HstRequest request, final HstResponse response) throws HstComponentException {
super.doBeforeRender(request, response);
HippoFolder folder = (HippoFolder) request.getRequestContext().getContentBean();
try {
request.setAttribute("publications", findAllDocuments(folder));
} catch (QueryException queryException) {
throw new HstComponentException("Exception occurred during folder search.", queryException);
}
}
use of org.hippoecm.hst.content.beans.query.exceptions.QueryException in project hippo by NHS-digital-website.
the class PublicationBase method getDatasets.
public List<Dataset> getDatasets() throws HstComponentException {
assertPropertyPermitted(PropertyKeys.DATASETS);
HstQueryResult hstQueryResult;
try {
hstQueryResult = HstQueryBuilder.create(getParentBean()).ofTypes(Dataset.class).build().execute();
} catch (QueryException queryException) {
log.error("Failed to find datasets for publication " + getCanonicalPath(), queryException);
throw new HstComponentException("Failed to find datasets for publication " + getCanonicalPath(), queryException);
}
ArrayList<Dataset> hippoBeans = Lists.newArrayList((Iterator) hstQueryResult.getHippoBeans());
hippoBeans.sort(DocumentTitleComparator.COMPARATOR);
return hippoBeans;
}
Aggregations