Class SolrResponseStandardFacetDecorator
java.lang.Object
com.broadleafcommerce.search.provider.solr.response.SolrResponseFacetDecorator<org.apache.solr.client.solrj.response.FacetField,org.apache.solr.client.solrj.response.FacetField.Count>
com.broadleafcommerce.search.provider.solr.response.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
FacetResponse
s associated to standard valued non-ranged facets-
Field Summary
Fields inherited from class com.broadleafcommerce.search.provider.solr.response.SolrResponseFacetDecorator
solrFieldService
-
Constructor Summary
ConstructorsConstructorDescriptionSolrResponseStandardFacetDecorator
(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.FacetField.Count value, com.broadleafcommerce.search.api.domain.Filter facetFilter) Create theFacetValue
for this facet value.protected String
getSolrFacetFieldName
(org.apache.solr.client.solrj.response.FacetField solrFacet) Get the Solr field name for the facet.protected List<org.apache.solr.client.solrj.response.FacetField>
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.FacetField.Count>
getSolrFacetValues
(org.apache.solr.client.solrj.response.FacetField solrFacet) Retrieve the values with counts from the Solr facet.protected boolean
isActiveFacetValue
(org.apache.solr.client.solrj.response.FacetField.Count facetValue, com.broadleafcommerce.search.api.domain.Filter facetFilter) Check if this facet's filter is active on this value.Methods inherited from class com.broadleafcommerce.search.provider.solr.response.SolrResponseFacetDecorator
buildFacetFromField, buildFacetResponse, buildFacetResponses, buildFacetValues, decorate, facetMatchesField, getFacetFilter, getFacetForField, getSolrFieldService, getTypeFactory, sortFacetResponses
-
Constructor Details
-
SolrResponseStandardFacetDecorator
public SolrResponseStandardFacetDecorator(com.broadleafcommerce.search.provider.solr.SolrFieldService solrFieldService, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-
-
Method Details
-
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 theQueryResponse
- Specified by:
getSolrFacets
in classSolrResponseFacetDecorator<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
Description copied from class:SolrResponseFacetDecorator
Get the Solr field name for the facet.- Specified by:
getSolrFacetFieldName
in classSolrResponseFacetDecorator<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 classSolrResponseFacetDecorator<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 theFacetValue
for this facet value.- Specified by:
buildFacetValue
in classSolrResponseFacetDecorator<org.apache.solr.client.solrj.response.FacetField,
org.apache.solr.client.solrj.response.FacetField.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
-
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 activefacetFilter
- the filter on this facet- Returns:
- whether the facet is filtered on this value
-