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 int
DEFAULT_ALIVE_CHECK_INTERVAL
protected static java.lang.String
DEFAULT_CONFIGSET_PROPERTY
protected static java.lang.String
DEFAULT_CONFIGSET_VALUE
protected static int
DEFAULT_CONNECTION_TIMEOUT
protected static int
DEFAULT_MAX_CONNECTIONS
protected static int
DEFAULT_MAX_CONNECTIONS_PER_HOST
protected static int
DEFAULT_SOCKET_TIMEOUT
protected static java.lang.String
INDEX_PARAM
protected static java.lang.String
JSON_CONTENT_TYPE
protected static java.lang.String
MANAGED_IGNORE_CASE_FIELD
protected static java.lang.String
MANAGED_INIT_ARGS_FIELD
protected static java.lang.String
MANAGED_LIST_FIELD
protected static java.lang.String
MANAGED_MAP_FIELD
protected static java.lang.String
MANAGED_RESOURCES_PATH
protected static java.lang.String
MANAGED_RESOURCES_ROOT_FIELD
protected static java.lang.String
MANAGED_STOP_WORDS_IGNORE_CASE_KEY
protected static java.lang.String
MANAGED_STOP_WORDS_PATH
protected static java.lang.String
MANAGED_STOP_WORDS_ROOT_FIELD
protected static java.lang.String
MANAGED_STOP_WORDS_TYPE
protected static java.lang.String
MANAGED_SYNONYMS_IGNORE_CASE_KEY
protected static java.lang.String
MANAGED_SYNONYMS_PATH
protected static java.lang.String
MANAGED_SYNONYMS_ROOT_FIELD
protected static java.lang.String
MANAGED_SYNONYMS_TYPE
protected static java.lang.String
SOLR_QUERY_SELECT_ALL
protected static java.lang.String
SYNONYM_SPLIT_CHAR
protected static java.lang.String
UTF8_ENCODING
-
Constructor Summary
Constructors Constructor Description AbstractSolrSearchProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
buildSynonyms(java.util.Map<java.lang.String,java.util.Set<java.lang.String>> synonyms, java.lang.String from, java.lang.String to)
protected void
closeHttpClient(org.apache.http.client.HttpClient httpClient)
protected java.util.List<java.lang.String>
collectLanguages(FacetSearchConfig configuration)
void
commit(Index index, SolrSearchProvider.CommitType commitType)
Performs a commit on the given index.protected org.apache.http.client.HttpClient
createHttpClient(SolrClientConfig solrClientConfig)
void
deleteAllDocuments(Index index)
Deletes all documents from an index.void
deleteDocumentsByPk(Index index, java.util.Collection<PK> pks)
Deletes documents matching the provided list of pksvoid
deleteOldDocuments(Index index, long indexOperationId)
Deletes old documents from an index.protected java.lang.String
encode(java.lang.String string)
protected void
executeDelete(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 void
executePost(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 void
exportConfig(Index index, org.apache.solr.client.solrj.SolrClient solrClient)
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)
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)
ConfigurationService
getConfigurationService()
IndexNameResolver
getIndexNameResolver()
protected int
getIntegerValue(java.lang.Integer bigInt, int defaultValue)
SolrClientPool
getSolrClientPool()
SolrFacetSearchConfigDao
getSolrFacetSearchConfigDao()
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)
void
optimize(Index index)
Optimizes a given index.protected java.lang.String
resolveConfigSet(Index index)
Index
resolveIndex(FacetSearchConfig facetSearchConfig, IndexedType indexedType, java.lang.String qualifier)
Resolves an index.void
setConfigurationService(ConfigurationService configurationService)
void
setIndexNameResolver(IndexNameResolver indexNameResolver)
void
setSolrClientPool(SolrClientPool solrClientPool)
void
setSolrFacetSearchConfigDao(SolrFacetSearchConfigDao solrFacetSearchConfigDao)
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)
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)
-
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:SolrSearchProvider
Resolves an index. Resolving an index only creates a search provider specific instance ofIndex
.- Specified by:
resolveIndex
in 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:SolrSearchProvider
Deletes all documents from an index.- Specified by:
deleteAllDocuments
in 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:SolrSearchProvider
Deletes old documents from an index. Old documents are documents that were not created/updated since a given index operation.- Specified by:
deleteOldDocuments
in 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:SolrSearchProvider
Deletes documents matching the provided list of pks- Specified by:
deleteDocumentsByPk
in 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:SolrSearchProvider
Performs 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:
commit
in 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:SolrSearchProvider
Optimizes a given index. It does not wait for the operation to complete.- Specified by:
optimize
in 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:
SolrServiceException
org.apache.solr.client.solrj.SolrServerException
java.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.SolrServerException
java.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.IOException
SolrServiceException
-
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.SolrServerException
java.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:
SolrServiceException
org.apache.solr.client.solrj.SolrServerException
java.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.IOException
SolrServiceException
-
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.SolrServerException
java.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:
SolrServiceException
org.apache.solr.client.solrj.SolrServerException
java.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.SolrServerException
java.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.SolrServerException
java.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.SolrServerException
java.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)
-
-