Class AbstractSolrSearchProvider
- java.lang.Object
-
- de.hybris.platform.solrfacetsearch.solr.impl.AbstractSolrSearchProvider
-
- All Implemented Interfaces:
SolrSearchProvider
- Direct Known Subclasses:
SolrCloudSearchProvider,SolrStandaloneSearchProvider
public abstract class AbstractSolrSearchProvider extends java.lang.Object implements SolrSearchProvider
Abstract implementation ofSolrSearchProvider.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface de.hybris.platform.solrfacetsearch.solr.SolrSearchProvider
SolrSearchProvider.CommitType
-
-
Field Summary
Fields Modifier and Type Field Description protected static intDEFAULT_ALIVE_CHECK_INTERVALprotected static java.lang.StringDEFAULT_CONFIGSET_PROPERTYprotected static java.lang.StringDEFAULT_CONFIGSET_VALUEprotected static intDEFAULT_CONNECTION_TIMEOUTprotected static intDEFAULT_MAX_CONNECTIONSprotected static intDEFAULT_MAX_CONNECTIONS_PER_HOSTprotected static intDEFAULT_SOCKET_TIMEOUTprotected static java.lang.StringINDEX_PARAMprotected static java.lang.StringJSON_CONTENT_TYPEprotected static java.lang.StringMANAGED_IGNORE_CASE_FIELDprotected static java.lang.StringMANAGED_INIT_ARGS_FIELDprotected static java.lang.StringMANAGED_LIST_FIELDprotected static java.lang.StringMANAGED_MAP_FIELDprotected static java.lang.StringMANAGED_RESOURCES_PATHprotected static java.lang.StringMANAGED_RESOURCES_ROOT_FIELDprotected static java.lang.StringMANAGED_STOP_WORDS_IGNORE_CASE_KEYprotected static java.lang.StringMANAGED_STOP_WORDS_PATHprotected static java.lang.StringMANAGED_STOP_WORDS_ROOT_FIELDprotected static java.lang.StringMANAGED_STOP_WORDS_TYPEprotected static java.lang.StringMANAGED_SYNONYMS_IGNORE_CASE_KEYprotected static java.lang.StringMANAGED_SYNONYMS_PATHprotected static java.lang.StringMANAGED_SYNONYMS_ROOT_FIELDprotected static java.lang.StringMANAGED_SYNONYMS_TYPEprotected static java.lang.StringSOLR_QUERY_SELECT_ALLprotected static java.lang.StringSYNONYM_SPLIT_CHARprotected static java.lang.StringUTF8_ENCODING
-
Constructor Summary
Constructors Constructor Description AbstractSolrSearchProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidbuildSynonyms(java.util.Map<java.lang.String,java.util.Set<java.lang.String>> synonyms, java.lang.String from, java.lang.String to)protected voidcloseHttpClient(org.apache.http.client.HttpClient httpClient)protected java.util.List<java.lang.String>collectLanguages(FacetSearchConfig configuration)voidcommit(Index index, SolrSearchProvider.CommitType commitType)Performs a commit on the given index.protected org.apache.http.client.HttpClientcreateHttpClient(SolrClientConfig solrClientConfig)voiddeleteAllDocuments(Index index)Deletes all documents from an index.voiddeleteDocumentsByPk(Index index, java.util.Collection<PK> pks)Deletes documents matching the provided list of pksvoiddeleteOldDocuments(Index index, long indexOperationId)Deletes old documents from an index.protected java.lang.Stringencode(java.lang.String string)protected voidexecuteDelete(org.apache.solr.client.solrj.SolrClient solrClient, java.lang.String indexName, java.lang.String path)protected org.apache.solr.common.util.NamedList<java.lang.Object>executeGet(org.apache.solr.client.solrj.SolrClient solrClient, java.lang.String indexName, java.lang.String path)protected voidexecutePost(org.apache.solr.client.solrj.SolrClient solrClient, java.lang.String indexName, java.lang.String path, java.lang.Object payload)protected java.util.List<java.lang.String>expandSynonyms(java.lang.String value)protected voidexportConfig(Index index, org.apache.solr.client.solrj.SolrClient solrClient)protected voidexportStopWords(Index index, org.apache.solr.client.solrj.SolrClient solrClient, java.util.Map<java.lang.String,ManagedResource> managedResources, java.util.List<java.lang.String> languages)protected voidexportSynonyms(Index index, org.apache.solr.client.solrj.SolrClient solrClient, java.util.Map<java.lang.String,ManagedResource> managedResources, java.util.List<java.lang.String> languages)ConfigurationServicegetConfigurationService()IndexNameResolvergetIndexNameResolver()protected intgetIntegerValue(java.lang.Integer bigInt, int defaultValue)SolrClientPoolgetSolrClientPool()SolrFacetSearchConfigDaogetSolrFacetSearchConfigDao()protected java.util.Map<java.lang.String,ManagedResource>loadManagedResourcesFromServer(Index index, org.apache.solr.client.solrj.SolrClient solrClient)protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>>loadStopWordsFromConfiguration(FacetSearchConfig facetSearchConfig, java.util.Collection<java.lang.String> languages)protected java.util.Set<java.lang.String>loadStopWordsFromServer(org.apache.solr.client.solrj.SolrClient solrClient, java.lang.String indexName, java.lang.String managedResourcePath)protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.Set<java.lang.String>>>loadSynonymsFromConfiguration(FacetSearchConfig facetSearchConfig, java.util.Collection<java.lang.String> languages)protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>>loadSynonymsFromServer(org.apache.solr.client.solrj.SolrClient solrClient, java.lang.String indexName, java.lang.String managedResourcePath)voidoptimize(Index index)Optimizes a given index.protected java.lang.StringresolveConfigSet(Index index)IndexresolveIndex(FacetSearchConfig facetSearchConfig, IndexedType indexedType, java.lang.String qualifier)Resolves an index.voidsetConfigurationService(ConfigurationService configurationService)voidsetIndexNameResolver(IndexNameResolver indexNameResolver)voidsetSolrClientPool(SolrClientPool solrClientPool)voidsetSolrFacetSearchConfigDao(SolrFacetSearchConfigDao solrFacetSearchConfigDao)protected voidupdateStopWordsOnServer(org.apache.solr.client.solrj.SolrClient solrClient, java.lang.String indexName, java.lang.String managedResourcePath, java.util.Set<java.lang.String> stopWords, java.util.Set<java.lang.String> serverStopWords)protected voidupdateSynonymsOnServer(org.apache.solr.client.solrj.SolrClient solrClient, java.lang.String indexName, java.lang.String managedResourcePath, java.util.Map<java.lang.String,java.util.Set<java.lang.String>> synonyms, java.util.Map<java.lang.String,java.util.Set<java.lang.String>> serverSynonyms)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.hybris.platform.solrfacetsearch.solr.SolrSearchProvider
createIndex, deleteIndex, exportConfig, getClient, getClientForIndexing
-
-
-
-
Field Detail
-
INDEX_PARAM
protected static final java.lang.String INDEX_PARAM
- See Also:
- Constant Field Values
-
DEFAULT_ALIVE_CHECK_INTERVAL
protected static final int DEFAULT_ALIVE_CHECK_INTERVAL
- See Also:
- Constant Field Values
-
DEFAULT_MAX_CONNECTIONS
protected static final int DEFAULT_MAX_CONNECTIONS
- See Also:
- Constant Field Values
-
DEFAULT_MAX_CONNECTIONS_PER_HOST
protected static final int DEFAULT_MAX_CONNECTIONS_PER_HOST
- See Also:
- Constant Field Values
-
DEFAULT_SOCKET_TIMEOUT
protected static final int DEFAULT_SOCKET_TIMEOUT
- See Also:
- Constant Field Values
-
DEFAULT_CONNECTION_TIMEOUT
protected static final int DEFAULT_CONNECTION_TIMEOUT
- See Also:
- Constant Field Values
-
DEFAULT_CONFIGSET_PROPERTY
protected static final java.lang.String DEFAULT_CONFIGSET_PROPERTY
- See Also:
- Constant Field Values
-
DEFAULT_CONFIGSET_VALUE
protected static final java.lang.String DEFAULT_CONFIGSET_VALUE
- See Also:
- Constant Field Values
-
SYNONYM_SPLIT_CHAR
protected static final java.lang.String SYNONYM_SPLIT_CHAR
- See Also:
- Constant Field Values
-
MANAGED_INIT_ARGS_FIELD
protected static final java.lang.String MANAGED_INIT_ARGS_FIELD
- See Also:
- Constant Field Values
-
MANAGED_IGNORE_CASE_FIELD
protected static final java.lang.String MANAGED_IGNORE_CASE_FIELD
- See Also:
- Constant Field Values
-
MANAGED_LIST_FIELD
protected static final java.lang.String MANAGED_LIST_FIELD
- See Also:
- Constant Field Values
-
MANAGED_MAP_FIELD
protected static final java.lang.String MANAGED_MAP_FIELD
- See Also:
- Constant Field Values
-
MANAGED_RESOURCES_PATH
protected static final java.lang.String MANAGED_RESOURCES_PATH
- See Also:
- Constant Field Values
-
MANAGED_RESOURCES_ROOT_FIELD
protected static final java.lang.String MANAGED_RESOURCES_ROOT_FIELD
- See Also:
- Constant Field Values
-
MANAGED_SYNONYMS_IGNORE_CASE_KEY
protected static final java.lang.String MANAGED_SYNONYMS_IGNORE_CASE_KEY
- See Also:
- Constant Field Values
-
MANAGED_SYNONYMS_TYPE
protected static final java.lang.String MANAGED_SYNONYMS_TYPE
- See Also:
- Constant Field Values
-
MANAGED_SYNONYMS_PATH
protected static final java.lang.String MANAGED_SYNONYMS_PATH
- See Also:
- Constant Field Values
-
MANAGED_SYNONYMS_ROOT_FIELD
protected static final java.lang.String MANAGED_SYNONYMS_ROOT_FIELD
- See Also:
- Constant Field Values
-
MANAGED_STOP_WORDS_IGNORE_CASE_KEY
protected static final java.lang.String MANAGED_STOP_WORDS_IGNORE_CASE_KEY
- See Also:
- Constant Field Values
-
MANAGED_STOP_WORDS_TYPE
protected static final java.lang.String MANAGED_STOP_WORDS_TYPE
- See Also:
- Constant Field Values
-
MANAGED_STOP_WORDS_PATH
protected static final java.lang.String MANAGED_STOP_WORDS_PATH
- See Also:
- Constant Field Values
-
MANAGED_STOP_WORDS_ROOT_FIELD
protected static final java.lang.String MANAGED_STOP_WORDS_ROOT_FIELD
- See Also:
- Constant Field Values
-
JSON_CONTENT_TYPE
protected static final java.lang.String JSON_CONTENT_TYPE
- See Also:
- Constant Field Values
-
UTF8_ENCODING
protected static final java.lang.String UTF8_ENCODING
- See Also:
- Constant Field Values
-
SOLR_QUERY_SELECT_ALL
protected static final java.lang.String SOLR_QUERY_SELECT_ALL
- See Also:
- Constant Field Values
-
-
Method Detail
-
resolveIndex
public Index resolveIndex(FacetSearchConfig facetSearchConfig, IndexedType indexedType, java.lang.String qualifier)
Description copied from interface:SolrSearchProviderResolves an index. Resolving an index only creates a search provider specific instance ofIndex.- Specified by:
resolveIndexin interfaceSolrSearchProvider- Parameters:
facetSearchConfig- - the facet search configurationindexedType- - the indexed typequalifier- - the qualifier- Returns:
- the index
-
deleteAllDocuments
public void deleteAllDocuments(Index index) throws SolrServiceException
Description copied from interface:SolrSearchProviderDeletes all documents from an index.- Specified by:
deleteAllDocumentsin interfaceSolrSearchProvider- Parameters:
index- - the index- Throws:
SolrServiceException- if an error occurs
-
deleteOldDocuments
public void deleteOldDocuments(Index index, long indexOperationId) throws SolrServiceException
Description copied from interface:SolrSearchProviderDeletes old documents from an index. Old documents are documents that were not created/updated since a given index operation.- Specified by:
deleteOldDocumentsin interfaceSolrSearchProvider- Parameters:
index- - the indexindexOperationId- - the index operation id- Throws:
SolrServiceException- if an error occurs
-
deleteDocumentsByPk
public void deleteDocumentsByPk(Index index, java.util.Collection<PK> pks) throws SolrServiceException
Description copied from interface:SolrSearchProviderDeletes documents matching the provided list of pks- Specified by:
deleteDocumentsByPkin interfaceSolrSearchProvider- Parameters:
index- - the indexpks- - the pks list- Throws:
SolrServiceException- if an error occurs
-
commit
public void commit(Index index, SolrSearchProvider.CommitType commitType) throws SolrServiceException
Description copied from interface:SolrSearchProviderPerforms a commit on the given index. An hard commit makes sure that indexed documents are persisted and visible, a soft commit makes sure indexed documents are visible.- Specified by:
commitin interfaceSolrSearchProvider- Parameters:
index- - the indexcommitType- - the commit type- Throws:
SolrServiceException- if an error occurs
-
optimize
public void optimize(Index index) throws SolrServiceException
Description copied from interface:SolrSearchProviderOptimizes a given index. It does not wait for the operation to complete.- Specified by:
optimizein interfaceSolrSearchProvider- Parameters:
index- - the index- Throws:
SolrServiceException- if an error occurs
-
resolveConfigSet
protected java.lang.String resolveConfigSet(Index index)
-
getIntegerValue
protected int getIntegerValue(java.lang.Integer bigInt, int defaultValue)
-
createHttpClient
protected org.apache.http.client.HttpClient createHttpClient(SolrClientConfig solrClientConfig)
-
closeHttpClient
protected void closeHttpClient(org.apache.http.client.HttpClient httpClient)
-
exportConfig
protected void exportConfig(Index index, org.apache.solr.client.solrj.SolrClient solrClient) throws SolrServiceException, org.apache.solr.client.solrj.SolrServerException, java.io.IOException
- Throws:
SolrServiceExceptionorg.apache.solr.client.solrj.SolrServerExceptionjava.io.IOException
-
loadManagedResourcesFromServer
protected java.util.Map<java.lang.String,ManagedResource> loadManagedResourcesFromServer(Index index, org.apache.solr.client.solrj.SolrClient solrClient) throws org.apache.solr.client.solrj.SolrServerException, java.io.IOException
- Throws:
org.apache.solr.client.solrj.SolrServerExceptionjava.io.IOException
-
collectLanguages
protected java.util.List<java.lang.String> collectLanguages(FacetSearchConfig configuration)
-
exportSynonyms
protected void exportSynonyms(Index index, org.apache.solr.client.solrj.SolrClient solrClient, java.util.Map<java.lang.String,ManagedResource> managedResources, java.util.List<java.lang.String> languages) throws java.io.IOException, SolrServiceException
- Throws:
java.io.IOExceptionSolrServiceException
-
loadSynonymsFromConfiguration
protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.Set<java.lang.String>>> loadSynonymsFromConfiguration(FacetSearchConfig facetSearchConfig, java.util.Collection<java.lang.String> languages)
-
buildSynonyms
protected void buildSynonyms(java.util.Map<java.lang.String,java.util.Set<java.lang.String>> synonyms, java.lang.String from, java.lang.String to)
-
expandSynonyms
protected java.util.List<java.lang.String> expandSynonyms(java.lang.String value)
-
loadSynonymsFromServer
protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> loadSynonymsFromServer(org.apache.solr.client.solrj.SolrClient solrClient, java.lang.String indexName, java.lang.String managedResourcePath) throws org.apache.solr.client.solrj.SolrServerException, java.io.IOException- Throws:
org.apache.solr.client.solrj.SolrServerExceptionjava.io.IOException
-
updateSynonymsOnServer
protected void updateSynonymsOnServer(org.apache.solr.client.solrj.SolrClient solrClient, java.lang.String indexName, java.lang.String managedResourcePath, java.util.Map<java.lang.String,java.util.Set<java.lang.String>> synonyms, java.util.Map<java.lang.String,java.util.Set<java.lang.String>> serverSynonyms) throws SolrServiceException, org.apache.solr.client.solrj.SolrServerException, java.io.IOException- Throws:
SolrServiceExceptionorg.apache.solr.client.solrj.SolrServerExceptionjava.io.IOException
-
exportStopWords
protected void exportStopWords(Index index, org.apache.solr.client.solrj.SolrClient solrClient, java.util.Map<java.lang.String,ManagedResource> managedResources, java.util.List<java.lang.String> languages) throws java.io.IOException, SolrServiceException
- Throws:
java.io.IOExceptionSolrServiceException
-
loadStopWordsFromConfiguration
protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> loadStopWordsFromConfiguration(FacetSearchConfig facetSearchConfig, java.util.Collection<java.lang.String> languages)
-
loadStopWordsFromServer
protected java.util.Set<java.lang.String> loadStopWordsFromServer(org.apache.solr.client.solrj.SolrClient solrClient, java.lang.String indexName, java.lang.String managedResourcePath) throws org.apache.solr.client.solrj.SolrServerException, java.io.IOException- Throws:
org.apache.solr.client.solrj.SolrServerExceptionjava.io.IOException
-
updateStopWordsOnServer
protected void updateStopWordsOnServer(org.apache.solr.client.solrj.SolrClient solrClient, java.lang.String indexName, java.lang.String managedResourcePath, java.util.Set<java.lang.String> stopWords, java.util.Set<java.lang.String> serverStopWords) throws SolrServiceException, org.apache.solr.client.solrj.SolrServerException, java.io.IOException- Throws:
SolrServiceExceptionorg.apache.solr.client.solrj.SolrServerExceptionjava.io.IOException
-
encode
protected java.lang.String encode(java.lang.String string) throws SolrServiceException- Throws:
SolrServiceException
-
executeGet
protected org.apache.solr.common.util.NamedList<java.lang.Object> executeGet(org.apache.solr.client.solrj.SolrClient solrClient, java.lang.String indexName, java.lang.String path) throws org.apache.solr.client.solrj.SolrServerException, java.io.IOException- Throws:
org.apache.solr.client.solrj.SolrServerExceptionjava.io.IOException
-
executePost
protected void executePost(org.apache.solr.client.solrj.SolrClient solrClient, java.lang.String indexName, java.lang.String path, java.lang.Object payload) throws org.apache.solr.client.solrj.SolrServerException, java.io.IOException- Throws:
org.apache.solr.client.solrj.SolrServerExceptionjava.io.IOException
-
executeDelete
protected void executeDelete(org.apache.solr.client.solrj.SolrClient solrClient, java.lang.String indexName, java.lang.String path) throws org.apache.solr.client.solrj.SolrServerException, java.io.IOException- Throws:
org.apache.solr.client.solrj.SolrServerExceptionjava.io.IOException
-
getSolrFacetSearchConfigDao
public SolrFacetSearchConfigDao getSolrFacetSearchConfigDao()
-
setSolrFacetSearchConfigDao
public void setSolrFacetSearchConfigDao(SolrFacetSearchConfigDao solrFacetSearchConfigDao)
-
getIndexNameResolver
public IndexNameResolver getIndexNameResolver()
-
setIndexNameResolver
public void setIndexNameResolver(IndexNameResolver indexNameResolver)
-
getConfigurationService
public ConfigurationService getConfigurationService()
-
setConfigurationService
public void setConfigurationService(ConfigurationService configurationService)
-
getSolrClientPool
public SolrClientPool getSolrClientPool()
-
setSolrClientPool
public void setSolrClientPool(SolrClientPool solrClientPool)
-
-