Class SolrResponseStandardFacetDecorator

  • All Implemented Interfaces:
    SolrResponseDecorator

    public class SolrResponseStandardFacetDecorator
    extends SolrResponseFacetDecorator<org.apache.solr.client.solrj.response.FacetField,​org.apache.solr.client.solrj.response.FacetField.Count>
    Decorates the SearchResponse with FacetResponses associated to standard valued non-ranged facets
    • Constructor Detail

      • SolrResponseStandardFacetDecorator

        public SolrResponseStandardFacetDecorator​(com.broadleafcommerce.search.provider.solr.SolrFieldService solrFieldService,
                                                  com.broadleafcommerce.common.extension.TypeFactory typeFactory)
    • Method Detail

      • getSolrFacets

        protected List<org.apache.solr.client.solrj.response.FacetField> getSolrFacets​(org.apache.solr.client.solrj.response.QueryResponse queryResponse)
        Description copied from class: SolrResponseFacetDecorator
        Retrieve the facets for this facet type from the QueryResponse
        Specified by:
        getSolrFacets in class SolrResponseFacetDecorator<org.apache.solr.client.solrj.response.FacetField,​org.apache.solr.client.solrj.response.FacetField.Count>
        Parameters:
        queryResponse - Response from Solr for search
        Returns:
        All facets of the type to process
      • getSolrFacetFieldName

        protected String getSolrFacetFieldName​(org.apache.solr.client.solrj.response.FacetField solrFacet)
        Description copied from class: SolrResponseFacetDecorator
        Get the Solr field name for the facet.
        Specified by:
        getSolrFacetFieldName in class SolrResponseFacetDecorator<org.apache.solr.client.solrj.response.FacetField,​org.apache.solr.client.solrj.response.FacetField.Count>
        Parameters:
        solrFacet - Facet from Solr
        Returns:
        Type-qualified Solr field name
      • getSolrFacetValues

        protected List<org.apache.solr.client.solrj.response.FacetField.Count> getSolrFacetValues​(org.apache.solr.client.solrj.response.FacetField solrFacet)
        Description copied from class: SolrResponseFacetDecorator
        Retrieve the values with counts from the Solr facet.
        Specified by:
        getSolrFacetValues in class SolrResponseFacetDecorator<org.apache.solr.client.solrj.response.FacetField,​org.apache.solr.client.solrj.response.FacetField.Count>
        Parameters:
        solrFacet - Facet from Solr
        Returns:
        Values for the facet
      • buildFacetValue

        protected com.broadleafcommerce.search.api.domain.FacetValue buildFacetValue​(com.broadleafcommerce.search.api.domain.Facet facet,
                                                                                     org.apache.solr.client.solrj.response.FacetField.Count value,
                                                                                     @Nullable
                                                                                     com.broadleafcommerce.search.api.domain.Filter facetFilter)
        Description copied from class: SolrResponseFacetDecorator
        Create the FacetValue for this facet value.
        Specified by:
        buildFacetValue in class SolrResponseFacetDecorator<org.apache.solr.client.solrj.response.FacetField,​org.apache.solr.client.solrj.response.FacetField.Count>
        Parameters:
        facet - Search facet to which this value belongs
        value - Facet value from Solr facet
        facetFilter - Current filter associated with this facet on search
        Returns:
        Search facet value for this type of facet
      • isActiveFacetValue

        protected boolean isActiveFacetValue​(org.apache.solr.client.solrj.response.FacetField.Count facetValue,
                                             @Nullable
                                             com.broadleafcommerce.search.api.domain.Filter facetFilter)
        Check if this facet's filter is active on this value.
        Parameters:
        facetValue - the value to check if active
        facetFilter - the filter on this facet
        Returns:
        whether the facet is filtered on this value