Class TypeAheadFieldPreProcessor

  • All Implemented Interfaces:
    com.broadleafcommerce.search.core.service.TypeAheadPreProcessor<org.apache.solr.client.solrj.SolrQuery>, org.springframework.core.Ordered

    public class TypeAheadFieldPreProcessor
    extends Object
    implements com.broadleafcommerce.search.core.service.TypeAheadPreProcessor<org.apache.solr.client.solrj.SolrQuery>
    Handles setting Solr's "fl" parameter on the initial search request.
    • Field Summary

      • Fields inherited from interface org.springframework.core.Ordered

        HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
    • Constructor Summary

      Constructors 
      Constructor Description
      TypeAheadFieldPreProcessor​(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 com.broadleafcommerce.search.core.service.locale.LocaleHelper getLocaleHelper()  
      int getOrder()  
      protected com.broadleafcommerce.search.provider.solr.SolrFieldService getSolrFieldService()  
      protected void populateTypeAheadFields​(org.apache.solr.client.solrj.SolrQuery query, com.broadleafcommerce.search.api.domain.TypeAheadConfiguration typeAheadConfiguration, com.broadleafcommerce.search.api.type.IndexableType type, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Populate the field list on the Solr query from configured type ahead fields.
      void preProcess​(org.apache.solr.client.solrj.SolrQuery query, com.broadleafcommerce.search.api.domain.typeahead.TypeAheadRequest typeAheadRequest, com.broadleafcommerce.search.api.domain.TypeAheadConfiguration configuration, com.broadleafcommerce.search.core.service.SearchRequestProperties properties, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)  
      protected String[] retrieveSolrFields​(com.broadleafcommerce.search.api.domain.TypeAheadConfiguration typeAheadConfiguration, String locale)
      Retrieves the query fields that are to be returned in the query result.
    • Constructor Detail

      • TypeAheadFieldPreProcessor

        public TypeAheadFieldPreProcessor​(com.broadleafcommerce.search.provider.solr.SolrFieldService solrFieldService,
                                          com.broadleafcommerce.search.core.service.locale.LocaleHelper localeHelper)
    • 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 configuration,
                               com.broadleafcommerce.search.core.service.SearchRequestProperties properties,
                               @Nullable
                               com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
        Specified by:
        preProcess in interface com.broadleafcommerce.search.core.service.TypeAheadPreProcessor<org.apache.solr.client.solrj.SolrQuery>
      • populateTypeAheadFields

        protected void populateTypeAheadFields​(org.apache.solr.client.solrj.SolrQuery query,
                                               com.broadleafcommerce.search.api.domain.TypeAheadConfiguration typeAheadConfiguration,
                                               com.broadleafcommerce.search.api.type.IndexableType type,
                                               @Nullable
                                               com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
        Populate the field list on the Solr query from configured type ahead fields.
        Parameters:
        query - the Solr query to search
        typeAheadConfiguration - the configuration containing type ahead fields
        type - the indexable type being searched
        context - (optional) The context information surrounding sandboxing/multitenant state
      • retrieveSolrFields

        protected String[] retrieveSolrFields​(com.broadleafcommerce.search.api.domain.TypeAheadConfiguration typeAheadConfiguration,
                                              @Nullable
                                              String locale)
        Retrieves the query fields that are to be returned in the query result.
        Parameters:
        typeAheadConfiguration - The type ahead configuration.
        locale - (optional) the locale of the query
        Returns:
        An array of Solr fields or null if no fields are defined.
      • getOrder

        public int getOrder()
        Specified by:
        getOrder in interface org.springframework.core.Ordered
      • getSolrFieldService

        protected com.broadleafcommerce.search.provider.solr.SolrFieldService getSolrFieldService()
      • getLocaleHelper

        protected com.broadleafcommerce.search.core.service.locale.LocaleHelper getLocaleHelper()