Class DefaultSolrSearchProvider
- java.lang.Object
-
- com.broadleafcommerce.search.provider.solr.AbstractBasicAuthAwareSolrProvider
-
- com.broadleafcommerce.search.provider.solr.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
-
-
Field Summary
Fields Modifier and Type Field Description static String
SOLR_FIELD_CACHE
-
Fields inherited from class com.broadleafcommerce.search.provider.solr.AbstractBasicAuthAwareSolrProvider
CLUSTER_STATUS_PATH
-
-
Constructor Summary
Constructors Constructor Description DefaultSolrSearchProvider(org.apache.solr.client.solrj.SolrClient solrClient, SolrCollectionResolver collectionResolver, org.apache.solr.client.solrj.SolrRequest.METHOD queryMethod, String userName, String password, com.broadleafcommerce.common.extension.cache.CacheStateManager cacheStateManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected SolrCollectionResolver
getCollectionResolver()
Set<String>
getDefinedFields(com.broadleafcommerce.search.api.type.IndexableType indexableType, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
protected Set<String>
getDefinedFieldsInternal(com.broadleafcommerce.search.api.type.IndexableType indexableType)
Retrieve all fields defined in Solr for a particular indexable type.protected org.apache.solr.client.solrj.SolrRequest.METHOD
getQueryMethod()
org.apache.solr.client.solrj.response.QueryResponse
search(org.apache.solr.client.solrj.SolrQuery solrQuery, com.broadleafcommerce.search.api.type.IndexableType indexableType)
Execute a Solr search for the provided requested query and type.org.apache.solr.client.solrj.response.QueryResponse
search(org.apache.solr.client.solrj.SolrQuery solrQuery, String collection)
Execute a Solr search for the provided requested query and collection.-
Methods inherited from class com.broadleafcommerce.search.provider.solr.AbstractBasicAuthAwareSolrProvider
determineCollectionsFromAliases, getSolrBasicAuthPassword, getSolrBasicAuthUser, getSolrClient, reloadCollections, reloadCollectionsFromAliases, setBasicAuthCredentialsIfNecessary
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.broadleafcommerce.search.provider.solr.SolrProvider
getSolrClient
-
-
-
-
Field Detail
-
SOLR_FIELD_CACHE
public static final String SOLR_FIELD_CACHE
- See Also:
- Constant Field Values
-
-
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 interfacecom.broadleafcommerce.search.provider.SearchProvider<org.apache.solr.client.solrj.SolrQuery,org.apache.solr.client.solrj.response.QueryResponse>
- Parameters:
solrQuery
- The solr query to search byindexableType
- 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 interfacecom.broadleafcommerce.search.provider.SearchProvider<org.apache.solr.client.solrj.SolrQuery,org.apache.solr.client.solrj.response.QueryResponse>
- Parameters:
solrQuery
- The solr query to search bycollection
- 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.
-
getCollectionResolver
protected SolrCollectionResolver getCollectionResolver()
-
getQueryMethod
protected org.apache.solr.client.solrj.SolrRequest.METHOD getQueryMethod()
-
-