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
Modifier and TypeFieldDescriptionprotected JackrabbitRepository
The JCR repositoryprotected String
The solr core prefix.The Solr "default" update clients, per workspaceThe Solr "no auto commit" update clients, per workspaceprotected org.apache.solr.client.solrj.SolrClient
The Solr read client.The solr socket timeout (in millis).protected String
The solr URL.protected WorkspaceSelector
The workspace selector.Fields inherited from interface org.ametys.cms.search.solr.SolrClientProvider
ROLE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
dispose()
Get the name of the collection to use.getCollectionName
(String workspaceName) Get the collection to use.org.apache.solr.client.solrj.SolrClient
Get the "read" mode solr client.org.apache.solr.client.solrj.SolrClient
getUpdateClient
(String workspaceName, boolean autoCommit) Get a Solr client suited to update.void
void
service
(ServiceManager serviceManager) Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:
service
in interfaceServiceable
- Throws:
ServiceException
-
initialize
- Specified by:
initialize
in interfaceInitializable
- Throws:
Exception
-
dispose
- Specified by:
dispose
in interfaceDisposable
-
getReadClient
Description copied from interface:SolrClientProvider
Get the "read" mode solr client.- Specified by:
getReadClient
in interfaceSolrClientProvider
- Returns:
- the "read" mode solr client.
-
getUpdateClient
public org.apache.solr.client.solrj.SolrClient getUpdateClient(String workspaceName, boolean autoCommit) Description copied from interface:SolrClientProvider
Get a Solr client suited to update.
You must call this method withfalse
value for argument `autocommit` so as to get a client that will not trigger any autocommit on Solr side.
Otherwise, calling this method withtrue
value for argument `autocommit` is equivalent to callingSolrClientProvider.getUpdateClient(String)
- Specified by:
getUpdateClient
in interfaceSolrClientProvider
- Parameters:
workspaceName
- The name of the workspaceautoCommit
-false
so 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:SolrClientProvider
Get the name of the collection to use.- Specified by:
getCollectionName
in interfaceSolrClientProvider
- Returns:
- The name of the collection to search in.
-
getCollectionName
Description copied from interface:SolrClientProvider
Get the collection to use.- Specified by:
getCollectionName
in interfaceSolrClientProvider
- Parameters:
workspaceName
- The workspace name.- Returns:
- The name of the collection to search in.
-