Search in sources :

Example 1 with HippoFacetNavigationBean

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));
    }
}
Also used : HippoFacetNavigationBean(org.hippoecm.hst.content.beans.standard.HippoFacetNavigationBean) TaxonomyManager(org.onehippo.taxonomy.api.TaxonomyManager) Taxonomy(org.onehippo.taxonomy.api.Taxonomy)

Example 2 with HippoFacetNavigationBean

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);
}
Also used : HippoBean(org.hippoecm.hst.content.beans.standard.HippoBean) HippoFacetNavigationBean(org.hippoecm.hst.content.beans.standard.HippoFacetNavigationBean) HippoResultSetBean(org.hippoecm.hst.content.beans.standard.HippoResultSetBean)

Aggregations

HippoFacetNavigationBean (org.hippoecm.hst.content.beans.standard.HippoFacetNavigationBean)2 HippoBean (org.hippoecm.hst.content.beans.standard.HippoBean)1 HippoResultSetBean (org.hippoecm.hst.content.beans.standard.HippoResultSetBean)1 Taxonomy (org.onehippo.taxonomy.api.Taxonomy)1 TaxonomyManager (org.onehippo.taxonomy.api.TaxonomyManager)1