Class DefaultSolrSearchProvider

  • All Implemented Interfaces:
    com.broadleafcommerce.search.provider.SearchProvider<org.apache.solr.client.solrj.SolrQuery,​org.apache.solr.client.solrj.response.QueryResponse>, SolrProvider

    public class DefaultSolrSearchProvider
    extends AbstractBasicAuthAwareSolrProvider
    implements com.broadleafcommerce.search.provider.SearchProvider<org.apache.solr.client.solrj.SolrQuery,​org.apache.solr.client.solrj.response.QueryResponse>, SolrProvider
    • Constructor Detail

      • DefaultSolrSearchProvider

        public DefaultSolrSearchProvider​(org.apache.solr.client.solrj.SolrClient solrClient,
                                         SolrCollectionResolver collectionResolver,
                                         org.apache.solr.client.solrj.SolrRequest.METHOD queryMethod,
                                         @Nullable
                                         String userName,
                                         @Nullable
                                         String password,
                                         @Nullable
                                         com.broadleafcommerce.common.extension.cache.CacheStateManager cacheStateManager)
    • Method Detail

      • search

        public org.apache.solr.client.solrj.response.QueryResponse search​(org.apache.solr.client.solrj.SolrQuery solrQuery,
                                                                          com.broadleafcommerce.search.api.type.IndexableType indexableType)
                                                                   throws com.broadleafcommerce.search.api.SearchException
        Execute a Solr search for the provided requested query and type.
        Specified by:
        search in interface com.broadleafcommerce.search.provider.SearchProvider<org.apache.solr.client.solrj.SolrQuery,​org.apache.solr.client.solrj.response.QueryResponse>
        Parameters:
        solrQuery - The solr query to search by
        indexableType - The indexable type to search for
        Returns:
        QueryResponse from Solr
        Throws:
        com.broadleafcommerce.search.api.SearchException - if an error occurs searching in Solr
      • search

        public org.apache.solr.client.solrj.response.QueryResponse search​(org.apache.solr.client.solrj.SolrQuery solrQuery,
                                                                          String collection)
                                                                   throws com.broadleafcommerce.search.api.SearchException
        Execute a Solr search for the provided requested query and collection.
        Specified by:
        search in interface com.broadleafcommerce.search.provider.SearchProvider<org.apache.solr.client.solrj.SolrQuery,​org.apache.solr.client.solrj.response.QueryResponse>
        Parameters:
        solrQuery - The solr query to search by
        collection - The collection to search in
        Returns:
        QueryResponse from Solr
        Throws:
        com.broadleafcommerce.search.api.SearchException - if an error occurs searching in Solr
      • getDefinedFields

        public Set<String> getDefinedFields​(com.broadleafcommerce.search.api.type.IndexableType indexableType,
                                            @Nullable
                                            com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      • getDefinedFieldsInternal

        protected Set<String> getDefinedFieldsInternal​(com.broadleafcommerce.search.api.type.IndexableType indexableType)
        Retrieve all fields defined in Solr for a particular indexable type. This is a workaround for a bug with the edismax query parser. This can be removed/re-evaluated if/when this bug is fixed: https://issues.apache.org/jira/browse/SOLR-6376
        Parameters:
        indexableType - The indexable type
        Returns:
        All fields, including dynamic fields, that have been defined in Solr.
      • getQueryMethod

        protected org.apache.solr.client.solrj.SolrRequest.METHOD getQueryMethod()