Class TypeAheadFacetFieldsPreProcessor
- java.lang.Object
-
- com.broadleafcommerce.search.provider.solr.typeahead.preprocessors.TypeAheadFacetFieldsPreProcessor
-
- All Implemented Interfaces:
com.broadleafcommerce.search.core.service.TypeAheadPreProcessor<org.apache.solr.client.solrj.SolrQuery>
,org.springframework.core.Ordered
public class TypeAheadFacetFieldsPreProcessor extends Object implements com.broadleafcommerce.search.core.service.TypeAheadPreProcessor<org.apache.solr.client.solrj.SolrQuery>
This pre-processor is responsible for handling
suggestion configurations
marked asfaceted
. This will set the desired Facet fields on the SolrQuery, as well as limit the facet results, if aresult limit
is set.
-
-
Constructor Summary
Constructors Constructor Description TypeAheadFacetFieldsPreProcessor(com.broadleafcommerce.search.provider.solr.SolrFieldService solrFieldService, com.broadleafcommerce.search.core.service.locale.LocaleHelper localeHelper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Map<String,Integer>
getFacetFieldsWithLimits(List<com.broadleafcommerce.search.api.domain.TypeAheadSuggestionConfiguration> typeAheadSuggestionConfigurations, String locale)
Returns a map of faceted fields configured for the type ahead suggestions, along with the limit on their results to return.protected com.broadleafcommerce.search.core.service.locale.LocaleHelper
getLocaleHelper()
int
getOrder()
protected com.broadleafcommerce.search.provider.solr.SolrFieldService
getSolrFieldService()
protected boolean
isLimitedFacet(Map<String,Integer> facetFields, String field)
Check whether the matching facet field should have limited results.void
preProcess(org.apache.solr.client.solrj.SolrQuery query, com.broadleafcommerce.search.api.domain.typeahead.TypeAheadRequest typeAheadRequest, com.broadleafcommerce.search.api.domain.TypeAheadConfiguration typeAheadConfiguration, com.broadleafcommerce.search.core.service.SearchRequestProperties properties, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
protected void
setFacetFields(org.apache.solr.client.solrj.SolrQuery query, com.broadleafcommerce.search.api.domain.TypeAheadConfiguration typeAheadConfiguration, String locale)
Configure faceting for fields on the type ahead query.
-
-
-
Method Detail
-
preProcess
public void preProcess(org.apache.solr.client.solrj.SolrQuery query, com.broadleafcommerce.search.api.domain.typeahead.TypeAheadRequest typeAheadRequest, com.broadleafcommerce.search.api.domain.TypeAheadConfiguration typeAheadConfiguration, com.broadleafcommerce.search.core.service.SearchRequestProperties properties, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
- Specified by:
preProcess
in interfacecom.broadleafcommerce.search.core.service.TypeAheadPreProcessor<org.apache.solr.client.solrj.SolrQuery>
-
setFacetFields
protected void setFacetFields(org.apache.solr.client.solrj.SolrQuery query, com.broadleafcommerce.search.api.domain.TypeAheadConfiguration typeAheadConfiguration, @Nullable String locale)
Configure faceting for fields on the type ahead query.- Parameters:
query
- the Solr query to search ontypeAheadConfiguration
- the configuration with suggestion fields for facetinglocale
- (optional) the locale of the query
-
getFacetFieldsWithLimits
protected Map<String,Integer> getFacetFieldsWithLimits(List<com.broadleafcommerce.search.api.domain.TypeAheadSuggestionConfiguration> typeAheadSuggestionConfigurations, @Nullable String locale)
Returns a map of faceted fields configured for the type ahead suggestions, along with the limit on their results to return.- Parameters:
typeAheadSuggestionConfigurations
- the configured suggestions for type aheadlocale
- (optional) the locale of the query- Returns:
- map of faceted fields and their result limits
-
isLimitedFacet
protected boolean isLimitedFacet(Map<String,Integer> facetFields, String field)
Check whether the matching facet field should have limited results.- Parameters:
facetFields
- map of faceted fields and their result limitsfield
- field to check for limit- Returns:
- whether the matching facet field should have limited results
-
getOrder
public int getOrder()
- Specified by:
getOrder
in interfaceorg.springframework.core.Ordered
-
getSolrFieldService
protected com.broadleafcommerce.search.provider.solr.SolrFieldService getSolrFieldService()
-
getLocaleHelper
protected com.broadleafcommerce.search.core.service.locale.LocaleHelper getLocaleHelper()
-
-