use of org.hippoecm.hst.content.beans.standard.HippoFacetNavigationBean in project hippo by NHS-digital-website.
the class FacetComponent method doBeforeRender.
@Override
public void doBeforeRender(HstRequest request, HstResponse response) {
if (request.getRequestContext().getAttribute("isContentSearch") != null) {
request.setAttribute("isContentSearch", request.getRequestContext().getAttribute("isContentSearch"));
if (request.getRequestContext().getAttribute("taxonomyHierarchy") != null && request.getRequestContext().getAttribute("taxonomyTotalDepth") != null) {
request.setAttribute("taxonomyTotalDepth", request.getRequestContext().getAttribute("taxonomyTotalDepth"));
request.setAttribute("taxonomyHierarchy", request.getRequestContext().getAttribute("taxonomyHierarchy"));
}
} else {
TaxonomyManager taxonomyManager = HstServices.getComponentManager().getComponent(TaxonomyManager.class.getName());
Taxonomy taxonomy = taxonomyManager.getTaxonomies().getTaxonomy(HippoBeanHelper.PUBLICATION_TAXONOMY);
HippoFacetNavigationBean facetNavigationBean = getFacetNavigationBean(request);
TaxonomyFacetWrapper taxonomyWrapper = facetNavigationBean == null ? null : new TaxonomyFacetWrapper(taxonomy, facetNavigationBean);
request.setAttribute("taxonomy", taxonomyWrapper);
request.setAttribute("query", getQueryParameter(request));
request.setAttribute("facets", facetNavigationBean);
request.getRequestContext().setAttribute("facets", facetNavigationBean);
request.setAttribute("cparam", getComponentInfo(request));
}
}
use of org.hippoecm.hst.content.beans.standard.HippoFacetNavigationBean in project hippo by NHS-digital-website.
the class SearchComponent method buildAndExecuteHstSearch.
private void buildAndExecuteHstSearch(HstRequest request, SearchComponentInfo paramInfo) {
HippoFacetNavigationBean facetNavigationBean = getFacetNavigationBean(request);
if (facetNavigationBean != null) {
HippoResultSetBean resultSet = facetNavigationBean.getResultSet();
if (resultSet != null) {
Pageable<HippoBean> pageable = getPageableFactory().createPageable(resultSet.getDocumentIterator(HippoBean.class), facetNavigationBean.getCount().intValue(), paramInfo.getPageSize(), getCurrentPage(request));
request.setAttribute("pageable", pageable);
request.setAttribute("pageNumbers", getHstPageNumbers(pageable));
}
}
setCommonSearchRequestAttributes(request, paramInfo);
request.setAttribute("area", getAreaOption(request).toString());
request.setAttribute("facets", facetNavigationBean);
}
Aggregations