public class SolrIndexer extends AbstractLogEnabled implements Component, Serviceable, Initializable, Contextualizable
Modifier and Type | Class and Description |
---|---|
(package private) class |
SolrIndexer.IndexationResult |
Modifier and Type | Field and Description |
---|---|
private static ThreadLocal<SimpleDateFormat> |
__DATE_FORMAT |
private static int |
__SOLR_STRING_NB_BYTES_LIMIT |
protected String |
_ametysInternalUrl
The Ametys internal URL used by Solr to query Ametys
|
private static String |
_CONFIGSET_NAME_PREFIX |
protected Context |
_context
The avalon context
|
private static List<String> |
_READ_ONLY_FIELDS |
private static List<String> |
_READ_ONLY_FIELDTYPES |
protected ReadAccessHelper |
_readAccessHelper
The helper for read access
|
protected AmetysObjectResolver |
_resolver
The ametys object resolver.
|
protected SchemaDefinitionProviderExtensionPoint |
_schemaDefProviderEP
The schema definition provider extension point.
|
protected SchemaHelper |
_schemaHelper
The schema helper.
|
protected SolrClientProvider |
_solrClientProvider
The Solr client provider
|
protected SolrContentIndexer |
_solrContentIndexer
Solr Ametys contents indexer
|
protected String |
_solrCorePrefix
The solr core prefix.
|
protected SolrResourceIndexer |
_solrResourceIndexer
Solr resource indexer.
|
protected SolrWorkflowIndexer |
_solrWorkflowIndexer
Solr workflow indexer.
|
protected WorkspaceSelector |
_workspaceSelector
The workspace selector.
|
static String |
ROLE
The component role.
|
Constructor and Description |
---|
SolrIndexer() |
Modifier and Type | Method and Description |
---|---|
private <T> void |
_addField(SolrInputDocument document,
String fieldName,
Set<T> values,
Function<T,String> stringifier) |
private void |
_createConfigset(String name) |
private SolrClient |
_defaultSolrClient() |
private void |
_doIndexContent(Content content,
String workspaceName,
boolean indexAttachments,
SolrClient solrClient) |
protected SolrClient |
_getAutoCommitSolrClient(String workspaceName)
Gets the 'autocommit' Solr client
|
protected SolrClient |
_getNoAutoCommitSolrClient(String workspaceName)
Gets the 'no autocommit' Solr client
|
private void |
_indexContentAttachment(Resource resource,
SolrInputDocument document,
Content content) |
protected void |
_indexResourceDocument(Resource resource,
SolrInputDocument document,
SolrClient solrClient)
Index a populated solr input document of type Resource.
|
private void |
_unindexAllResources(String workspaceName,
SolrClient solrClient) |
protected void |
addCustomUpdates(List<org.apache.solr.client.solrj.request.schema.SchemaRequest.Update> updates,
SchemaFields schemaFields)
Compute the list of custom
SchemaRequest.Update directives. |
protected void |
addStaticSchemaUpdates(List<org.apache.solr.client.solrj.request.schema.SchemaRequest.Update> updates,
org.apache.solr.client.solrj.response.schema.SchemaRepresentation staticSchema,
SchemaFields schemaFields)
Compute the list of
SchemaRequest.Update directives from the static schema. |
protected void |
clearSchema(SolrClient solrClient,
String collection)
Delete all the fields of the existing schema in the given collection.
|
void |
commit()
Process a Solr commit operation in all workspaces.
|
void |
commit(String workspaceName,
SolrClient solrClient)
Process a Solr commit operation in given workspace.
|
void |
contextualize(Context context) |
void |
createCore(String name)
Create a Solr core.
|
static SimpleDateFormat |
dateFormat()
Returns the formatter for indexing dates.
|
protected boolean |
definitionExists(SchemaDefinition definition,
SchemaFields schemaFields)
Test if the given schema definition exists in the given
SchemaFields reference. |
void |
deleteCore(String name)
Delete a Solr core.
|
protected void |
deleteRepeaterDocs(String contentId,
String workspaceName,
SolrClient solrClient)
Delete repeater documents of a specified content.
|
protected void |
doIndexContent(Content content,
String workspaceName,
SolrClient solrClient)
Add or update a content into Solr index
|
protected SolrIndexer.IndexationResult |
doIndexContents(Iterable<Content> contents,
String workspaceName,
boolean indexAttachments,
SolrClient solrClient)
Send some contents for indexation in the solr server.
|
protected void |
doIndexContentWorkflow(Content content,
String workspaceName,
SolrClient solrClient)
Index the whole workflow of a content.
|
protected void |
doIndexExplorerItem(AmetysObject node,
String documentType,
TraversableAmetysObject resourceRoot,
SolrClient solrClient)
Add or update a resource into Solr index
|
protected void |
doIndexResource(Resource resource,
String documentType,
TraversableAmetysObject resourceRoot,
SolrClient solrClient)
Add or update a resource into Solr index
|
protected SolrIndexer.IndexationResult |
doIndexResources(Iterable<? extends AmetysObject> resources,
String documentType,
TraversableAmetysObject resourceRoot,
String workspaceName,
SolrClient solrClient)
Send some resources for indexation in the solr server.
|
protected void |
doUnindexContentAttachments(String contentId,
String workspaceName,
SolrClient solrClient)
Delete content attachments documents of a given content from the Solr server.
|
protected void |
doUnindexDocument(String id,
String workspaceName,
SolrClient solrClient)
Delete a document from the Solr server.
|
Set<String> |
getCoreNames()
Get the names of the Solr cores.
|
protected Set<String> |
getRealCoreNames()
Get the names of the Solr cores.
|
protected org.apache.solr.client.solrj.request.schema.SchemaRequest.Update |
getSchemaUpdate(SchemaDefinition definition)
Get the schema
SchemaRequest.Update directive from the given schema definition. |
void |
indexAclInitValues(AmetysObject ametysObject,
SolrInputDocument document)
Indexes read-ACl initial values for object
|
Map<String,Object> |
indexAllContents(String workspaceName,
boolean indexAttachments,
SolrClient solrClient)
Index all the contents in a given workspace.
|
Map<String,Object> |
indexAllResources(String workspaceName,
SolrClient solrClient)
Index all the resources in a given workspace.
|
void |
indexContent(String contentId,
boolean indexAttachments)
Add or update a content into Solr index on all workspaces and commit
|
void |
indexContent(String contentId,
String workspaceName,
boolean indexAttachments)
Add or update a content into Solr index
|
void |
indexContent(String contentId,
String workspaceName,
boolean indexAttachments,
SolrClient solrClient)
Add or update a content into Solr index
|
void |
indexContentAttachment(Resource resource,
Content content)
Index a content attachment
|
void |
indexContentAttachment(Resource resource,
Content content,
SolrClient solrClient)
Index a content attachment
|
void |
indexContentAttachments(ResourceCollection collection,
Content content)
Index content attachments as new entries in the idnex
|
void |
indexContentAttachments(ResourceCollection collection,
Content content,
SolrClient solrClient)
Index content attachments as new entries in the idnex
|
SolrIndexer.IndexationResult |
indexContents(Iterable<Content> contents)
Send a collection of contents for indexation in the solr server on all workspaces and commit
|
SolrIndexer.IndexationResult |
indexContents(Iterable<Content> contents,
String workspaceName,
boolean indexAttachments,
SolrClient solrClient)
Send a collection of contents for indexation in the solr server.
|
void |
indexResource(Resource resource,
String documentType,
String workspaceName)
Add or update a resource into Solr index
|
SolrIndexer.IndexationResult |
indexResources(Iterable<? extends AmetysObject> resources,
String documentType,
TraversableAmetysObject resourceRoot,
String workspaceName,
SolrClient solrClient)
Send a collection of contents for indexation in the solr server.
|
SolrIndexer.IndexationResult |
indexResources(Iterable<AmetysObject> resources,
String documentType,
String workspaceName)
Send a collection of contents for indexation in the solr server.
|
void |
indexSubcontents(String collectionId,
boolean indexAttachments)
Add or update the child contents of a
AmetysObjectCollection into Solr index, for all workspaces and commit |
void |
indexSubcontents(String collectionId,
String workspaceName,
boolean indexAttachments)
Index the child contents of a
AmetysObjectCollection |
void |
initialize() |
void |
optimize(String workspaceName,
SolrClient solrClient)
Launch a solr index optimization.
|
void |
reloadAclCache()
Reloads the ACL Solr cache for all users
|
void |
reloadAclCache(String workspaceName)
Reloads the ACL Solr cache for all users
|
void |
reloadAclCache(String workspaceName,
boolean checkIfNecessary)
Reloads the ACL Solr cache for all users
|
protected void |
reloadCores()
Reload the solr cores.
|
protected void |
reorderUpdates(List<org.apache.solr.client.solrj.request.schema.SchemaRequest.Update> updates)
Reorder the list of
SchemaRequest.Update directives. |
void |
sendSchema()
Send the schema.
|
void |
service(ServiceManager serviceManager) |
static String |
truncateUtf8StringValue(String value,
Logger logger,
String documentId,
String fieldName)
Truncates (if needed) the given string in order to be indexed without immense term error by Solr.
|
protected void |
unindexAllContents(String workspaceName,
boolean unindexAttachments,
SolrClient solrClient)
Unindex all content documents.
|
void |
unindexAllDocuments(String workspaceName,
SolrClient solrClient)
Delete all documents from the solr index.
|
void |
unindexContent(String contentId,
boolean unindexAttachments)
Remove a content from Solr index for all workspaces and commit
|
void |
unindexContent(String contentId,
String workspaceName,
boolean unindexAttachments)
Remove a content from Solr index
|
void |
unindexContent(String contentId,
String workspaceName,
boolean unindexAttachments,
SolrClient solrClient)
Remove a content from Solr index
|
void |
unindexContents(Collection<String> contentIds)
Remove a content from Solr index for all workspaces and commit
|
void |
unindexContents(Collection<String> contentIds,
String workspaceName)
Remove a content from Solr index
|
void |
unindexResource(String resourceId)
Remove a resource from Solr index for all workspaces and commit
|
void |
unindexResource(String resourceId,
String workspaceName)
Remove a resource from the Solr index.
|
void |
unindexResourcesByPath(String rootId,
String path)
Delete all resource documents at a given path for all workspaces and commit
|
void |
unindexResourcesByPath(String rootId,
String path,
String workspaceName)
Delete all resource documents at a given path.
|
void |
updateAmetysUrlCoreProperty()
Updates the ametys.url property of the Solr cores.
|
void |
updateSystemProperty(Content content,
String propertyId,
String workspaceName)
Update the value of a specific system property in a content document.
|
void |
updateSystemProperty(Content content,
String propertyId,
String workspaceName,
SolrClient solrClient)
Update the value of a specific system property in a content document.
|
getLogger, setLogger
private static final ThreadLocal<SimpleDateFormat> __DATE_FORMAT
private static final String _CONFIGSET_NAME_PREFIX
private static final List<String> _READ_ONLY_FIELDS
private static final List<String> _READ_ONLY_FIELDTYPES
private static final int __SOLR_STRING_NB_BYTES_LIMIT
protected AmetysObjectResolver _resolver
protected SchemaDefinitionProviderExtensionPoint _schemaDefProviderEP
protected SchemaHelper _schemaHelper
protected SolrContentIndexer _solrContentIndexer
protected SolrWorkflowIndexer _solrWorkflowIndexer
protected SolrResourceIndexer _solrResourceIndexer
protected SolrClientProvider _solrClientProvider
protected String _solrCorePrefix
protected String _ametysInternalUrl
protected WorkspaceSelector _workspaceSelector
protected ReadAccessHelper _readAccessHelper
public SolrIndexer()
public static SimpleDateFormat dateFormat()
public static String truncateUtf8StringValue(String value, Logger logger, String documentId, String fieldName)
value
- The string value to indexlogger
- The logger for logging in WARN level in case the given string is too long and will be truncated. Can be null if you do not want to log.documentId
- The id of the document being indexed. Can be null if you do not want to log.fieldName
- The name of the field being indexed. Can be null if you do not want to log.public void service(ServiceManager serviceManager) throws ServiceException
service
in interface Serviceable
ServiceException
public void initialize() throws Exception
initialize
in interface Initializable
Exception
public void contextualize(Context context) throws ContextException
contextualize
in interface Contextualizable
ContextException
protected SolrClient _getAutoCommitSolrClient(String workspaceName)
workspaceName
- The name of the workspaceprotected SolrClient _getNoAutoCommitSolrClient(String workspaceName)
workspaceName
- The name of the workspaceprivate SolrClient _defaultSolrClient()
public Set<String> getCoreNames() throws IOException, SolrServerException
IOException
- If an I/O error occurs.SolrServerException
- If a Solr error occurs.protected Set<String> getRealCoreNames() throws IOException, SolrServerException
IOException
- If an I/O error occurs.SolrServerException
- If a Solr error occurs.public void createCore(String name) throws IOException, SolrServerException
name
- The name of the core to create.IOException
- If an I/O error occurs.SolrServerException
- If a Solr error occurs.public void updateAmetysUrlCoreProperty()
private void _createConfigset(String name) throws IOException, SolrServerException
IOException
SolrServerException
public void deleteCore(String name) throws IOException, SolrServerException
name
- The name of the core to delete.IOException
- If an I/O error occurs.SolrServerException
- If a Solr error occurs.public void sendSchema() throws IOException, SolrServerException
IOException
- If a communication error occurs.SolrServerException
- If a solr error occurs.protected void addStaticSchemaUpdates(List<org.apache.solr.client.solrj.request.schema.SchemaRequest.Update> updates, org.apache.solr.client.solrj.response.schema.SchemaRepresentation staticSchema, SchemaFields schemaFields)
SchemaRequest.Update
directives from the static schema.updates
- The list of SchemaRequest.Update
directives to fill.staticSchema
- The static schema representation.schemaFields
- The current schema fields, used to track the existing fields (to be filled).protected void addCustomUpdates(List<org.apache.solr.client.solrj.request.schema.SchemaRequest.Update> updates, SchemaFields schemaFields)
SchemaRequest.Update
directives.updates
- The list of SchemaRequest.Update
directives to fill.schemaFields
- The current schema fields, used to track the existing fields (to be filled).protected void reorderUpdates(List<org.apache.solr.client.solrj.request.schema.SchemaRequest.Update> updates)
SchemaRequest.Update
directives.updates
- The list of SchemaRequest.Update
directives to reorder.protected boolean definitionExists(SchemaDefinition definition, SchemaFields schemaFields)
SchemaFields
reference.definition
- The schema definition to test.schemaFields
- The current schema fields.protected void clearSchema(SolrClient solrClient, String collection) throws IOException, SolrServerException
solrClient
- The Solr clientcollection
- The collection.IOException
- If a communication error occurs.SolrServerException
- If a solr error occurs.protected org.apache.solr.client.solrj.request.schema.SchemaRequest.Update getSchemaUpdate(SchemaDefinition definition)
SchemaRequest.Update
directive from the given schema definition.definition
- The schema definition to add.SchemaRequest.Update
directive.protected void reloadCores() throws IOException, SolrServerException
IOException
- If a communication error occurs.SolrServerException
- If a solr error occurs.public void reloadAclCache() throws IOException, SolrServerException, RepositoryException
IOException
- If an I/O error occurs.SolrServerException
- If a Solr error occurs.RepositoryException
- If a repository exception occurs when retrieving workspaces.public void reloadAclCache(String workspaceName) throws IOException, SolrServerException
workspaceName
- The workspace nameIOException
- If an I/O error occurs.SolrServerException
- If a Solr error occurs.public void reloadAclCache(String workspaceName, boolean checkIfNecessary) throws IOException, SolrServerException
workspaceName
- The workspace namecheckIfNecessary
- true to check if the reload is necessary for each segment (i.e. reload only the segments not already in cache)IOException
- If an I/O error occurs.SolrServerException
- If a Solr error occurs.public Map<String,Object> indexAllContents(String workspaceName, boolean indexAttachments, SolrClient solrClient) throws Exception
workspaceName
- the workspace where to indexindexAttachments
- to index content attachmentssolrClient
- The solr client to useException
- if an error occurs while indexing.protected void unindexAllContents(String workspaceName, boolean unindexAttachments, SolrClient solrClient) throws Exception
workspaceName
- The workspace nameunindexAttachments
- also unindex content attachmentssolrClient
- The solr client to useException
- if an error occurs while unindexing.public void indexSubcontents(String collectionId, boolean indexAttachments) throws Exception
AmetysObjectCollection
into Solr index, for all workspaces and commitcollectionId
- The id of collectionindexAttachments
- to index content attachmentsException
- if an error occurs while indexing.public void indexSubcontents(String collectionId, String workspaceName, boolean indexAttachments) throws Exception
AmetysObjectCollection
collectionId
- The id of collectionworkspaceName
- the workspace where to indexindexAttachments
- to index content attachmentsException
- if an error occurs while unindexing.public void indexContent(String contentId, boolean indexAttachments) throws Exception
contentId
- The id of the content to indexindexAttachments
- to index content attachmentsException
- if an error occurs while indexing.public void indexContent(String contentId, String workspaceName, boolean indexAttachments) throws Exception
contentId
- The id of the content to indexworkspaceName
- the workspace where to indexindexAttachments
- to index content attachmentsException
- if an error occurs while indexing.public void indexContent(String contentId, String workspaceName, boolean indexAttachments, SolrClient solrClient) throws Exception
contentId
- The id of the content to indexworkspaceName
- the workspace where to indexindexAttachments
- to index content attachmentssolrClient
- The solr client to useException
- if an error occurs while indexing.private void _doIndexContent(Content content, String workspaceName, boolean indexAttachments, SolrClient solrClient) throws IndexingException
IndexingException
public SolrIndexer.IndexationResult indexContents(Iterable<Content> contents) throws Exception
contents
- the collection of contents to index.Exception
- if an error occurs while indexing.public SolrIndexer.IndexationResult indexContents(Iterable<Content> contents, String workspaceName, boolean indexAttachments, SolrClient solrClient) throws Exception
contents
- the collection of contents to index.workspaceName
- the workspace where to indexindexAttachments
- to index content attachmentssolrClient
- The solr client to useException
- if an error occurs while indexing.protected SolrIndexer.IndexationResult doIndexContents(Iterable<Content> contents, String workspaceName, boolean indexAttachments, SolrClient solrClient) throws Exception
contents
- the contents to index.workspaceName
- The workspace nameindexAttachments
- to index content attachmentssolrClient
- The solr client to useException
- if an error occurs committing the results.public void updateSystemProperty(Content content, String propertyId, String workspaceName) throws Exception
content
- The content to update.propertyId
- The system property ID.workspaceName
- The workspace nameException
- if an error occurs while indexing.public void updateSystemProperty(Content content, String propertyId, String workspaceName, SolrClient solrClient) throws Exception
content
- The content to update.propertyId
- The system property ID.workspaceName
- The workspace namesolrClient
- The solr client to useException
- if an error occurs while indexing.public void unindexContent(String contentId, boolean unindexAttachments) throws Exception
contentId
- The id of content to unindexunindexAttachments
- also unindex content attachmentsException
- if an error occurs while indexing.public void unindexContent(String contentId, String workspaceName, boolean unindexAttachments) throws Exception
contentId
- The id of content to unindexworkspaceName
- The workspace where to work inunindexAttachments
- also unindex content attachmentsException
- if an error occurs while indexing.public void unindexContent(String contentId, String workspaceName, boolean unindexAttachments, SolrClient solrClient) throws Exception
contentId
- The id of content to unindexworkspaceName
- The workspace where to work inunindexAttachments
- also unindex content attachmentssolrClient
- The solr client to useException
- if an error occurs while indexing.public void unindexContents(Collection<String> contentIds) throws Exception
contentIds
- The id of content to unindexException
- if an error occurs while indexing.public void unindexContents(Collection<String> contentIds, String workspaceName) throws Exception
contentIds
- The id of content to unindexworkspaceName
- The workspace where to work inException
- if an error occurs while indexing.protected void doIndexContent(Content content, String workspaceName, SolrClient solrClient) throws Exception
content
- The content to indexworkspaceName
- The workspace where to indexsolrClient
- The solr client to useException
- if an error occurs while indexing.public void indexAclInitValues(AmetysObject ametysObject, SolrInputDocument document)
ametysObject
- The objectdocument
- The Solr documentprivate <T> void _addField(SolrInputDocument document, String fieldName, Set<T> values, Function<T,String> stringifier)
protected void doIndexContentWorkflow(Content content, String workspaceName, SolrClient solrClient) throws Exception
content
- The content.workspaceName
- The workspace namesolrClient
- The solr client to useException
- if an error occurs while indexing.public void indexContentAttachments(ResourceCollection collection, Content content) throws Exception
collection
- the collection of attachmentscontent
- the content whose attachments will be indexedException
- if something goes wrong when indexing the attachments of the contentpublic void indexContentAttachments(ResourceCollection collection, Content content, SolrClient solrClient) throws Exception
collection
- the collection of attachmentscontent
- the content whose attachments will be indexedsolrClient
- The solr client to useException
- if something goes wrong when indexing the attachments of the contentpublic void indexContentAttachment(Resource resource, Content content) throws Exception
public void indexContentAttachment(Resource resource, Content content, SolrClient solrClient) throws Exception
private void _indexContentAttachment(Resource resource, SolrInputDocument document, Content content) throws Exception
Exception
protected void _indexResourceDocument(Resource resource, SolrInputDocument document, SolrClient solrClient) throws SolrServerException, IOException
resource
- the resource from which the input document is createddocument
- the input documentsolrClient
- The solr client to useSolrServerException
- if there is an error on the serverIOException
- if there is a communication error with the serverprotected void deleteRepeaterDocs(String contentId, String workspaceName, SolrClient solrClient) throws Exception
workspaceName
- The workspace namecontentId
- the content ID.solrClient
- The solr client to useException
- if an error occurs while indexing.public Map<String,Object> indexAllResources(String workspaceName, SolrClient solrClient) throws Exception
workspaceName
- The workspace where to indexsolrClient
- The solr client to useException
- if an error occurs while indexing.public SolrIndexer.IndexationResult indexResources(Iterable<AmetysObject> resources, String documentType, String workspaceName) throws Exception
resources
- the collection of contents to index.documentType
- The document type of the resourceworkspaceName
- The workspace where to indexException
- if an error occurs while indexing.public SolrIndexer.IndexationResult indexResources(Iterable<? extends AmetysObject> resources, String documentType, TraversableAmetysObject resourceRoot, String workspaceName, SolrClient solrClient) throws Exception
resources
- the collection of contents to index.documentType
- The document type of the resourceresourceRoot
- The resource root, can be null. In that case, it will be computed for each resource.workspaceName
- The workspace where to indexsolrClient
- The solr client to useException
- if an error occurs while indexing.protected SolrIndexer.IndexationResult doIndexResources(Iterable<? extends AmetysObject> resources, String documentType, TraversableAmetysObject resourceRoot, String workspaceName, SolrClient solrClient) throws Exception
resources
- the resources to index.documentType
- The document type of the resourceresourceRoot
- The resource root, can be null. In that case, it will be computed for each resource.workspaceName
- The workspace where to indexsolrClient
- The solr client to useException
- if an error occurs committing the results.public void indexResource(Resource resource, String documentType, String workspaceName) throws Exception
resource
- The resource to indexdocumentType
- The document type of the resourceworkspaceName
- The workspace where to indexException
- if an error occurs while indexing.private void _unindexAllResources(String workspaceName, SolrClient solrClient) throws Exception
Exception
public void unindexResourcesByPath(String rootId, String path) throws Exception
rootId
- The resource root ID, must not be null.path
- The resource path relative to the given root, must start with a slash.Exception
- If an error occurs while unindexing.public void unindexResourcesByPath(String rootId, String path, String workspaceName) throws Exception
rootId
- The resource root ID, must not be null.path
- The resource path relative to the given root, must start with a slash.workspaceName
- The workspace where to work inException
- If an error occurs while unindexing.public void unindexResource(String resourceId) throws Exception
resourceId
- The id of resource to unindexException
- if an error occurs while indexing.public void unindexResource(String resourceId, String workspaceName) throws Exception
resourceId
- The id of resource to unindexworkspaceName
- The workspace where to work inException
- if an error occurs while unindexing.protected void doIndexExplorerItem(AmetysObject node, String documentType, TraversableAmetysObject resourceRoot, SolrClient solrClient) throws Exception
node
- The resource to indexdocumentType
- The document type of the resourceresourceRoot
- The resource root, can be null. In that case, it will be computed for each resource.solrClient
- The solr client to useException
- if an error occurs while indexing.protected void doIndexResource(Resource resource, String documentType, TraversableAmetysObject resourceRoot, SolrClient solrClient) throws Exception
resource
- The resource to indexdocumentType
- The document type of the resourceresourceRoot
- The resource root, can be null. In that case, it will be computed for each resource.solrClient
- The solr client to useException
- if an error occurs while indexing.public void commit() throws SolrServerException, IOException
NoAutoCommitUpdateClient
SolrServerException
- if there is an error on the serverIOException
- if there is a communication error with the serverpublic void commit(String workspaceName, SolrClient solrClient) throws SolrServerException, IOException
workspaceName
- The workspace's namesolrClient
- The solr client to useSolrServerException
- if there is an error on the serverIOException
- if there is a communication error with the serverpublic void optimize(String workspaceName, SolrClient solrClient) throws SolrServerException, IOException
workspaceName
- The workspace's namesolrClient
- The solr client to useSolrServerException
- if there is an error on the serverIOException
- if there is a communication error with the serverpublic void unindexAllDocuments(String workspaceName, SolrClient solrClient) throws Exception
workspaceName
- The workspace namesolrClient
- The solr client to useException
- if an error occurs while unindexing.protected void doUnindexDocument(String id, String workspaceName, SolrClient solrClient) throws Exception
id
- The id of the document to delete from SolrworkspaceName
- The workspace namesolrClient
- The solr client to useException
- if an error occurs while indexing.protected void doUnindexContentAttachments(String contentId, String workspaceName, SolrClient solrClient) throws Exception
contentId
- The id of the contentworkspaceName
- The workspace namesolrClient
- The solr client to useException
- if an error occurs while indexing.