Class SolrResponseRangedFacetDecorator

java.lang.Object
com.broadleafcommerce.search.provider.solr.response.SolrResponseFacetDecorator<org.apache.solr.client.solrj.response.IntervalFacet,org.apache.solr.client.solrj.response.IntervalFacet.Count>
com.broadleafcommerce.search.provider.solr.response.SolrResponseRangedFacetDecorator
All Implemented Interfaces:
SolrResponseDecorator

public class SolrResponseRangedFacetDecorator extends SolrResponseFacetDecorator<org.apache.solr.client.solrj.response.IntervalFacet,org.apache.solr.client.solrj.response.IntervalFacet.Count>
Decorates the SearchResponse with FacetResponses associated to ranged facets
  • Constructor Details

    • SolrResponseRangedFacetDecorator

      public SolrResponseRangedFacetDecorator(com.broadleafcommerce.search.provider.solr.SolrFieldService solrFieldService, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
  • Method Details

    • getSolrFacets

      protected List<org.apache.solr.client.solrj.response.IntervalFacet> 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.IntervalFacet,org.apache.solr.client.solrj.response.IntervalFacet.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.IntervalFacet 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.IntervalFacet,org.apache.solr.client.solrj.response.IntervalFacet.Count>
      Parameters:
      solrFacet - Facet from Solr
      Returns:
      Type-qualified Solr field name
    • getSolrFacetValues

      protected List<org.apache.solr.client.solrj.response.IntervalFacet.Count> getSolrFacetValues(org.apache.solr.client.solrj.response.IntervalFacet 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.IntervalFacet,org.apache.solr.client.solrj.response.IntervalFacet.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.IntervalFacet.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.IntervalFacet,org.apache.solr.client.solrj.response.IntervalFacet.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
    • getFacetRangeForInterval

      protected Optional<com.broadleafcommerce.search.api.domain.FacetRange> getFacetRangeForInterval(com.broadleafcommerce.search.api.domain.Facet facet, @Nullable String min, @Nullable String max)
      Get the FacetRange on the Facet with the given minimum and maximum values.
      Parameters:
      facet - the facet to find the range on
      min - the minimum value of the range to find, or null if no minimum
      max - the maximum value of the range to find, or null if no maximum
      Returns:
      if present, facet range for facet matching min and max values
    • getRangedFacetValueLabel

      protected String getRangedFacetValueLabel(com.broadleafcommerce.search.api.domain.FacetRange facetRange)
      Get the label from the FacetRange. If it has no specific label, then create a label with the min and max values.
      Parameters:
      facetRange - range to get the label for
      Returns:
      label for the range
    • isActiveFacetRange

      protected boolean isActiveFacetRange(com.broadleafcommerce.search.api.domain.FacetRange facetRange, @Nullable com.broadleafcommerce.search.api.domain.Filter facetFilter)
      Check if this facet's filter is active on this range.
      Parameters:
      facetRange - the range to check if active
      facetFilter - the filter on this facet
      Returns:
      whether the facet is filtered on this range