Package org.ametys.cms.search.solr
Class DefaultSolrClientProvider
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.cms.search.solr.DefaultSolrClientProvider
- All Implemented Interfaces:
SolrClientProvider,LogEnabled,Disposable,Initializable,Component,Serviceable
public class DefaultSolrClientProvider
extends AbstractLogEnabled
implements SolrClientProvider, Component, Serviceable, Initializable, Disposable
Component acting as a single entry point to get access to Solr clients.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected JackrabbitRepositoryThe JCR repositoryprotected StringThe solr core prefix.The Solr "default" update clients, per workspaceThe Solr "no auto commit" update clients, per workspaceprotected org.apache.solr.client.solrj.SolrClientThe Solr read client.The solr socket timeout (in millis).protected StringThe solr URL.protected WorkspaceSelectorThe workspace selector.Fields inherited from interface org.ametys.cms.search.solr.SolrClientProvider
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddispose()Get the name of the collection to use.getCollectionName(String workspaceName) Get the collection to use.org.apache.solr.client.solrj.SolrClientGet the "read" mode solr client.org.apache.solr.client.solrj.SolrClientgetUpdateClient(String workspaceName, boolean autoCommit) Get a Solr client suited to update.voidvoidservice(ServiceManager serviceManager) Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLoggerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.ametys.cms.search.solr.SolrClientProvider
getUpdateClient
-
Field Details
-
_workspaceSelector
The workspace selector. -
_repository
The JCR repository -
_solrReadClient
The Solr read client. -
_solrDefaultUpdateClients
The Solr "default" update clients, per workspace -
_solrNoAutoCommitUpdateClients
The Solr "no auto commit" update clients, per workspace -
_solrUrl
The solr URL. -
_solrSocketTimeout
The solr socket timeout (in millis). -
_solrCorePrefix
The solr core prefix.
-
-
Constructor Details
-
DefaultSolrClientProvider
public DefaultSolrClientProvider()
-
-
Method Details
-
service
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
initialize
- Specified by:
initializein interfaceInitializable- Throws:
Exception
-
dispose
- Specified by:
disposein interfaceDisposable
-
getReadClient
Description copied from interface:SolrClientProviderGet the "read" mode solr client.- Specified by:
getReadClientin interfaceSolrClientProvider- Returns:
- the "read" mode solr client.
-
getUpdateClient
public org.apache.solr.client.solrj.SolrClient getUpdateClient(String workspaceName, boolean autoCommit) Description copied from interface:SolrClientProviderGet a Solr client suited to update.
You must call this method withfalsevalue for argument `autocommit` so as to get a client that will not trigger any autocommit on Solr side.
Otherwise, calling this method withtruevalue for argument `autocommit` is equivalent to callingSolrClientProvider.getUpdateClient(String)- Specified by:
getUpdateClientin interfaceSolrClientProvider- Parameters:
workspaceName- The name of the workspaceautoCommit-falseso as to get a client that will not trigger any autocommit on Solr side.- Returns:
- a Solr client suited to update.
-
getCollectionName
Description copied from interface:SolrClientProviderGet the name of the collection to use.- Specified by:
getCollectionNamein interfaceSolrClientProvider- Returns:
- The name of the collection to search in.
-
getCollectionName
Description copied from interface:SolrClientProviderGet the collection to use.- Specified by:
getCollectionNamein interfaceSolrClientProvider- Parameters:
workspaceName- The workspace name.- Returns:
- The name of the collection to search in.
-