Package org.ametys.cms.indexing.solr
Class SolrWorkspaceIndexer
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.cms.indexing.solr.SolrWorkspaceIndexer
-
- All Implemented Interfaces:
WorkspaceIndexer
,LogEnabled
,Component
,Contextualizable
,Serviceable
- Direct Known Subclasses:
SolrWebWorkspaceIndexer
public class SolrWorkspaceIndexer extends AbstractLogEnabled implements WorkspaceIndexer, Component, Serviceable, Contextualizable
Component indexing a workspace in a Solr server.
-
-
Field Summary
Fields Modifier and Type Field Description protected Context
_context
The component context.protected DocumentProviderExtensionPoint
_docProviderEP
Additional documents provider extension point.protected Repository
_repository
The repository.protected SolrClientProvider
_solrClientProvider
The Solr client providerprotected SolrIndexer
_solrIndexer
The solr indexer.protected WorkspaceSelector
_workspaceSelector
The workspace selector.-
Fields inherited from interface org.ametys.cms.indexing.WorkspaceIndexer
ROLE
-
-
Constructor Summary
Constructors Constructor Description SolrWorkspaceIndexer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
_forceWorkspaceAndDoIndex(String workspaceName, boolean sendSchema)
private void
_index(String workspaceName, boolean ensureCoreExists, boolean sendSchema)
private void
_sendSchema()
void
contextualize(Context context)
protected void
doIndex(String workspaceName)
Index the given workspace.protected void
ensureCoreExists(String coreName)
Create the given core if it doesn't exist.protected void
ensureCoresExists(String[] coreNames)
Create the given cores if they do not exist.void
index(String workspaceName)
Index a workspace.protected void
indexAdditionalDocuments(String workspaceName, org.apache.solr.client.solrj.SolrClient solrClient)
Index additional documents provided by the extensions.void
indexAllWorkspaces()
Index all the workspaces.void
service(ServiceManager manager)
-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
_repository
protected Repository _repository
The repository.
-
_solrIndexer
protected SolrIndexer _solrIndexer
The solr indexer.
-
_workspaceSelector
protected WorkspaceSelector _workspaceSelector
The workspace selector.
-
_docProviderEP
protected DocumentProviderExtensionPoint _docProviderEP
Additional documents provider extension point.
-
_solrClientProvider
protected SolrClientProvider _solrClientProvider
The Solr client provider
-
-
Constructor Detail
-
SolrWorkspaceIndexer
public SolrWorkspaceIndexer()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
indexAllWorkspaces
public void indexAllWorkspaces() throws IndexingException
Description copied from interface:WorkspaceIndexer
Index all the workspaces.- Specified by:
indexAllWorkspaces
in interfaceWorkspaceIndexer
- Throws:
IndexingException
- If an error occurs while indexing.
-
_sendSchema
private void _sendSchema() throws IndexingException
- Throws:
IndexingException
-
index
public void index(String workspaceName) throws IndexingException
Description copied from interface:WorkspaceIndexer
Index a workspace.- Specified by:
index
in interfaceWorkspaceIndexer
- Parameters:
workspaceName
- The workspace name.- Throws:
IndexingException
- If an error occurs while indexing the workspace.
-
_index
private void _index(String workspaceName, boolean ensureCoreExists, boolean sendSchema) throws IndexingException
- Throws:
IndexingException
-
_forceWorkspaceAndDoIndex
private void _forceWorkspaceAndDoIndex(String workspaceName, boolean sendSchema) throws IndexingException
- Throws:
IndexingException
-
doIndex
protected void doIndex(String workspaceName) throws IndexingException
Index the given workspace.- Parameters:
workspaceName
- The workspace name.- Throws:
IndexingException
- If an error occurs indexing the workspace.
-
indexAdditionalDocuments
protected void indexAdditionalDocuments(String workspaceName, org.apache.solr.client.solrj.SolrClient solrClient) throws IndexingException
Index additional documents provided by the extensions.- Parameters:
workspaceName
- The workspace name.solrClient
- The solr client to use- Throws:
IndexingException
- If an error occurs while indexing.
-
ensureCoresExists
protected void ensureCoresExists(String[] coreNames) throws IndexingException
Create the given cores if they do not exist.- Parameters:
coreNames
- The core names.- Throws:
IndexingException
- If an error occurs while checking if cores exist.
-
ensureCoreExists
protected void ensureCoreExists(String coreName) throws IndexingException
Create the given core if it doesn't exist.- Parameters:
coreName
- The core name.- Throws:
IndexingException
- If an error occurs while checking if core exists.
-
-