Class DefaultSolrTypeAheadService

  • All Implemented Interfaces:
    com.broadleafcommerce.search.core.service.TypeAheadService

    public class DefaultSolrTypeAheadService
    extends Object
    implements com.broadleafcommerce.search.core.service.TypeAheadService
    • Constructor Summary

      Constructors 
      Constructor Description
      DefaultSolrTypeAheadService​(com.broadleafcommerce.search.provider.SearchProvider<org.apache.solr.client.solrj.SolrQuery,​org.apache.solr.client.solrj.response.QueryResponse> searchProvider, com.broadleafcommerce.search.core.service.QueryBuilder<org.apache.solr.client.solrj.SolrQuery> queryBuilder, com.broadleafcommerce.search.core.service.TypeAheadConfigurationService<com.broadleafcommerce.search.api.domain.TypeAheadConfiguration> service, com.broadleafcommerce.search.core.service.FieldDefinitionService<com.broadleafcommerce.search.api.domain.FieldDefinition> fieldDefinitionService, List<com.broadleafcommerce.search.core.service.TypeAheadPreProcessor<org.apache.solr.client.solrj.SolrQuery>> typeAheadPreProcessors, List<com.broadleafcommerce.search.core.service.TypeAheadPostProcessor<org.apache.solr.client.solrj.response.QueryResponse>> typeAheadPostProcessors)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected com.broadleafcommerce.search.core.service.SearchRequestProperties defaultProperties()  
      protected void executeTypeAheadPostProcessors​(com.broadleafcommerce.search.api.domain.typeahead.TypeAheadResponse response, org.apache.solr.client.solrj.response.QueryResponse queryResponse, com.broadleafcommerce.search.api.domain.typeahead.TypeAheadRequest request, com.broadleafcommerce.search.api.domain.TypeAheadConfiguration typeAheadConfiguration, com.broadleafcommerce.search.core.service.SearchRequestProperties properties, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Perform any response post-processing after executing the type ahead search.
      protected void executeTypeAheadPreProcessors​(org.apache.solr.client.solrj.SolrQuery query, com.broadleafcommerce.search.api.domain.TypeAheadConfiguration configuration, com.broadleafcommerce.search.api.domain.typeahead.TypeAheadRequest request, com.broadleafcommerce.search.core.service.SearchRequestProperties properties, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Perform any query pre-processing before executing the type ahead search.
      protected com.broadleafcommerce.search.api.domain.TypeAheadConfiguration getConfiguration​(String name, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Retrieve the TypeAheadConfiguration by name and hydrate any nested fields.
      protected com.broadleafcommerce.search.core.service.FieldDefinitionService<com.broadleafcommerce.search.api.domain.FieldDefinition> getFieldDefinitionService()  
      protected com.broadleafcommerce.search.core.service.QueryBuilder<org.apache.solr.client.solrj.SolrQuery> getQueryBuilder()  
      protected com.broadleafcommerce.search.provider.SearchProvider<org.apache.solr.client.solrj.SolrQuery,​org.apache.solr.client.solrj.response.QueryResponse> getSearchProvider()  
      com.broadleafcommerce.search.api.domain.typeahead.TypeAheadResponse getSuggestions​(com.broadleafcommerce.search.api.domain.typeahead.TypeAheadRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)  
      com.broadleafcommerce.search.api.domain.typeahead.TypeAheadResponse getSuggestions​(com.broadleafcommerce.search.api.domain.typeahead.TypeAheadRequest request, com.broadleafcommerce.search.core.service.SearchRequestProperties properties, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)  
      protected com.broadleafcommerce.search.core.service.TypeAheadConfigurationService<com.broadleafcommerce.search.api.domain.TypeAheadConfiguration> getTypeAheadConfigurationService()  
      protected List<com.broadleafcommerce.search.core.service.TypeAheadPostProcessor<org.apache.solr.client.solrj.response.QueryResponse>> getTypeAheadPostProcessors()  
      protected List<com.broadleafcommerce.search.core.service.TypeAheadPreProcessor<org.apache.solr.client.solrj.SolrQuery>> getTypeAheadPreProcessors()  
      protected void setDebugIfApplicable​(org.apache.solr.client.solrj.response.QueryResponse queryResponse, com.broadleafcommerce.search.api.domain.typeahead.TypeAheadResponse typeAheadResponse, com.broadleafcommerce.search.api.domain.typeahead.TypeAheadRequest request)
      Populate the raw query response if debug is active.
      protected com.broadleafcommerce.search.api.domain.SearchRequest typeAheadToSearchRequest​(com.broadleafcommerce.search.api.domain.typeahead.TypeAheadRequest request, com.broadleafcommerce.search.api.type.IndexableType type)  
    • Constructor Detail

      • DefaultSolrTypeAheadService

        public DefaultSolrTypeAheadService​(com.broadleafcommerce.search.provider.SearchProvider<org.apache.solr.client.solrj.SolrQuery,​org.apache.solr.client.solrj.response.QueryResponse> searchProvider,
                                           com.broadleafcommerce.search.core.service.QueryBuilder<org.apache.solr.client.solrj.SolrQuery> queryBuilder,
                                           com.broadleafcommerce.search.core.service.TypeAheadConfigurationService<com.broadleafcommerce.search.api.domain.TypeAheadConfiguration> service,
                                           com.broadleafcommerce.search.core.service.FieldDefinitionService<com.broadleafcommerce.search.api.domain.FieldDefinition> fieldDefinitionService,
                                           @Nullable
                                           List<com.broadleafcommerce.search.core.service.TypeAheadPreProcessor<org.apache.solr.client.solrj.SolrQuery>> typeAheadPreProcessors,
                                           @Nullable
                                           List<com.broadleafcommerce.search.core.service.TypeAheadPostProcessor<org.apache.solr.client.solrj.response.QueryResponse>> typeAheadPostProcessors)
    • Method Detail

      • getSuggestions

        public com.broadleafcommerce.search.api.domain.typeahead.TypeAheadResponse getSuggestions​(com.broadleafcommerce.search.api.domain.typeahead.TypeAheadRequest request,
                                                                                                  @Nullable
                                                                                                  com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
                                                                                           throws com.broadleafcommerce.search.api.SearchException
        Specified by:
        getSuggestions in interface com.broadleafcommerce.search.core.service.TypeAheadService
        Throws:
        com.broadleafcommerce.search.api.SearchException
      • getSuggestions

        public com.broadleafcommerce.search.api.domain.typeahead.TypeAheadResponse getSuggestions​(com.broadleafcommerce.search.api.domain.typeahead.TypeAheadRequest request,
                                                                                                  com.broadleafcommerce.search.core.service.SearchRequestProperties properties,
                                                                                                  @Nullable
                                                                                                  com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
                                                                                           throws com.broadleafcommerce.search.api.SearchException
        Specified by:
        getSuggestions in interface com.broadleafcommerce.search.core.service.TypeAheadService
        Throws:
        com.broadleafcommerce.search.api.SearchException
      • getConfiguration

        protected com.broadleafcommerce.search.api.domain.TypeAheadConfiguration getConfiguration​(String name,
                                                                                                  @Nullable
                                                                                                  com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
        Retrieve the TypeAheadConfiguration by name and hydrate any nested fields.
        Parameters:
        name - the name of the configuration to find
        context - (optional) The context information surrounding sandboxing/multitenant state
        Returns:
        the named configuration with hydrated nested fields
      • executeTypeAheadPreProcessors

        protected void executeTypeAheadPreProcessors​(org.apache.solr.client.solrj.SolrQuery query,
                                                     com.broadleafcommerce.search.api.domain.TypeAheadConfiguration configuration,
                                                     com.broadleafcommerce.search.api.domain.typeahead.TypeAheadRequest request,
                                                     com.broadleafcommerce.search.core.service.SearchRequestProperties properties,
                                                     @Nullable
                                                     com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Perform any query pre-processing before executing the type ahead search.
        Parameters:
        query - TypeAhead query to process
        configuration - TypeAhead configuration for the query
        request - original request
        properties - The properties for this request
        contextInfo - The context information surrounding sandboxing/multitenant state
      • executeTypeAheadPostProcessors

        protected void executeTypeAheadPostProcessors​(com.broadleafcommerce.search.api.domain.typeahead.TypeAheadResponse response,
                                                      org.apache.solr.client.solrj.response.QueryResponse queryResponse,
                                                      com.broadleafcommerce.search.api.domain.typeahead.TypeAheadRequest request,
                                                      com.broadleafcommerce.search.api.domain.TypeAheadConfiguration typeAheadConfiguration,
                                                      com.broadleafcommerce.search.core.service.SearchRequestProperties properties,
                                                      @Nullable
                                                      com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Perform any response post-processing after executing the type ahead search.
        Parameters:
        response - TypeAhead response to process
        queryResponse - the Solr query response
        typeAheadConfiguration - TypeAhead configuration for the query
        properties - The properties for this request
        contextInfo - The context information surrounding sandboxing/multitenant state
      • setDebugIfApplicable

        protected void setDebugIfApplicable​(org.apache.solr.client.solrj.response.QueryResponse queryResponse,
                                            com.broadleafcommerce.search.api.domain.typeahead.TypeAheadResponse typeAheadResponse,
                                            com.broadleafcommerce.search.api.domain.typeahead.TypeAheadRequest request)
        Populate the raw query response if debug is active.
        Parameters:
        queryResponse - the search engine response
        typeAheadResponse - the response to populate debug on
        request - the original request indicating if debug is active
      • typeAheadToSearchRequest

        protected com.broadleafcommerce.search.api.domain.SearchRequest typeAheadToSearchRequest​(com.broadleafcommerce.search.api.domain.typeahead.TypeAheadRequest request,
                                                                                                 com.broadleafcommerce.search.api.type.IndexableType type)
      • defaultProperties

        protected com.broadleafcommerce.search.core.service.SearchRequestProperties defaultProperties()
      • getSearchProvider

        protected com.broadleafcommerce.search.provider.SearchProvider<org.apache.solr.client.solrj.SolrQuery,​org.apache.solr.client.solrj.response.QueryResponse> getSearchProvider()
      • getTypeAheadPostProcessors

        protected List<com.broadleafcommerce.search.core.service.TypeAheadPostProcessor<org.apache.solr.client.solrj.response.QueryResponse>> getTypeAheadPostProcessors()
      • getTypeAheadPreProcessors

        protected List<com.broadleafcommerce.search.core.service.TypeAheadPreProcessor<org.apache.solr.client.solrj.SolrQuery>> getTypeAheadPreProcessors()
      • getTypeAheadConfigurationService

        protected com.broadleafcommerce.search.core.service.TypeAheadConfigurationService<com.broadleafcommerce.search.api.domain.TypeAheadConfiguration> getTypeAheadConfigurationService()
      • getFieldDefinitionService

        protected com.broadleafcommerce.search.core.service.FieldDefinitionService<com.broadleafcommerce.search.api.domain.FieldDefinition> getFieldDefinitionService()
      • getQueryBuilder

        protected com.broadleafcommerce.search.core.service.QueryBuilder<org.apache.solr.client.solrj.SolrQuery> getQueryBuilder()