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
FacetResponse
s associated to ranged facets-
Field Summary
Fields inherited from class com.broadleafcommerce.search.provider.solr.response.SolrResponseFacetDecorator
solrFieldService
-
Constructor Summary
ConstructorsConstructorDescriptionSolrResponseRangedFacetDecorator
(com.broadleafcommerce.search.provider.solr.SolrFieldService solrFieldService, com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected com.broadleafcommerce.search.api.domain.FacetValue
buildFacetValue
(com.broadleafcommerce.search.api.domain.Facet facet, org.apache.solr.client.solrj.response.IntervalFacet.Count value, com.broadleafcommerce.search.api.domain.Filter facetFilter) Create theFacetValue
for this facet value.protected Optional<com.broadleafcommerce.search.api.domain.FacetRange>
getFacetRangeForInterval
(com.broadleafcommerce.search.api.domain.Facet facet, String min, String max) Get theFacetRange
on theFacet
with the given minimum and maximum values.protected String
getRangedFacetValueLabel
(com.broadleafcommerce.search.api.domain.FacetRange facetRange) Get the label from theFacetRange
.protected String
getSolrFacetFieldName
(org.apache.solr.client.solrj.response.IntervalFacet solrFacet) Get the Solr field name for the facet.protected List<org.apache.solr.client.solrj.response.IntervalFacet>
getSolrFacets
(org.apache.solr.client.solrj.response.QueryResponse queryResponse) Retrieve the facets for this facet type from theQueryResponse
protected List<org.apache.solr.client.solrj.response.IntervalFacet.Count>
getSolrFacetValues
(org.apache.solr.client.solrj.response.IntervalFacet solrFacet) Retrieve the values with counts from the Solr facet.protected boolean
isActiveFacetRange
(com.broadleafcommerce.search.api.domain.FacetRange facetRange, com.broadleafcommerce.search.api.domain.Filter facetFilter) Check if this facet's filter is active on this range.Methods inherited from class com.broadleafcommerce.search.provider.solr.response.SolrResponseFacetDecorator
buildFacetFromField, buildFacetResponse, buildFacetResponses, buildFacetValues, decorate, facetMatchesField, getFacetFilter, getFacetForField, getSolrFieldService, getTypeFactory, sortFacetResponses
-
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 theQueryResponse
- Specified by:
getSolrFacets
in classSolrResponseFacetDecorator<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 classSolrResponseFacetDecorator<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 classSolrResponseFacetDecorator<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 theFacetValue
for this facet value.- Specified by:
buildFacetValue
in classSolrResponseFacetDecorator<org.apache.solr.client.solrj.response.IntervalFacet,
org.apache.solr.client.solrj.response.IntervalFacet.Count> - Parameters:
facet
- Search facet to which this value belongsvalue
- Facet value from Solr facetfacetFilter
- 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 theFacetRange
on theFacet
with the given minimum and maximum values.- Parameters:
facet
- the facet to find the range onmin
- the minimum value of the range to find, or null if no minimummax
- 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 theFacetRange
. 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 activefacetFilter
- the filter on this facet- Returns:
- whether the facet is filtered on this range
-