Class AbstractSolrIndexUpdateCommandHandlerImpl
java.lang.Object
org.broadleafcommerce.core.search.service.solr.indexer.AbstractSolrIndexUpdateCommandHandlerImpl
- All Implemented Interfaces:
SolrIndexUpdateCommandHandler
- Direct Known Subclasses:
CatalogSolrIndexUpdateCommandHandlerImpl
public abstract class AbstractSolrIndexUpdateCommandHandlerImpl
extends Object
implements SolrIndexUpdateCommandHandler
Component to provide basic functionality around handling SolrUpdateCommands.
- Author:
- Kelly Tisdell
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddDocument(String collection, org.apache.solr.common.SolrInputDocument doc) Adds the document to the specified collection but does not issue a commit.protected voidaddDocuments(String collection, List<org.apache.solr.common.SolrInputDocument> docs) Adds the documents to the specified collection but does not issue a commit.protected voidIssues a global commit command to Solr.protected voiddeleteByIds(String collection, List<String> ids) Deletes items by ids.protected voiddeleteByQueries(String collection, List<String> queries) Deletes items for the provided queries.protected voiddeleteByQuery(String collection, String query) Deletes items for the provided query.protected voidBy default, this will update the foreground collection.protected voidexecuteCommandInternal(IncrementalUpdateCommand command, String collectionName) This will apply updates in the specified collection, and will commit, when finished, if no errors occur.protected voidHook point for implementors to handle new command types.The background or "offline" collection (index) name or alias.Command group or identifier for which this component can respond.The "live" or customer facing collection (index) name or alias.protected abstract SolrConfigurationprotected voidIssues a global rollback of all items that have not yet been committed.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.broadleafcommerce.core.search.service.solr.indexer.SolrIndexUpdateCommandHandler
buildDocument, buildDocument, executeCommand
-
Constructor Details
-
AbstractSolrIndexUpdateCommandHandlerImpl
-
-
Method Details
-
getCommandGroup
Description copied from interface:SolrIndexUpdateCommandHandlerCommand group or identifier for which this component can respond. E.g. "catalog". Components that use the same command group operate on the same Solr collections / aliases (indexes).Multiple invocations of this method must return the same result.
- Specified by:
getCommandGroupin interfaceSolrIndexUpdateCommandHandler- Returns:
-
executeCommandInternal
protected void executeCommandInternal(IncrementalUpdateCommand command) throws org.broadleafcommerce.common.exception.ServiceException By default, this will update the foreground collection. Deletes, if available, will be applied first. Then, updates. This should be considered an autonomous method. Do not use this to make incremental updates within the scope of a larger update process because this will apply commits, by default.- Parameters:
command-- Throws:
org.broadleafcommerce.common.exception.ServiceException
-
executeCommandInternal
protected void executeCommandInternal(IncrementalUpdateCommand command, String collectionName) throws org.broadleafcommerce.common.exception.ServiceException This will apply updates in the specified collection, and will commit, when finished, if no errors occur. Deletes, if available, will be applied first. Then, updates. This should be considered an autonomous method. Do not use this to make incremental updates within the scope of a larger update process because this will apply commits, by default.- Parameters:
command-collectionName-- Throws:
org.broadleafcommerce.common.exception.ServiceException
-
executeCommandInternalNoDefaultCommandType
protected void executeCommandInternalNoDefaultCommandType(SolrUpdateCommand command) throws org.broadleafcommerce.common.exception.ServiceException Hook point for implementors to handle new command types.- Parameters:
command-- Throws:
Exceptionorg.broadleafcommerce.common.exception.ServiceException
-
commit
protected void commit(String collectionName, boolean waitFlush, boolean waitSearcher, boolean softCommit) throws Exception Issues a global commit command to Solr. Take care as anyone can issue a commit and since it's global it affects all updates. It is recommended that you off Solr's autoCommit and autoSoftCommit features.- Parameters:
collectionName-waitFlush-waitSearcher-softCommit-- Throws:
Exception
-
rollback
Issues a global rollback of all items that have not yet been committed. Take care as anyone can issue a commit and since it's global it affects all updates. It is recommended that you off Solr's autoCommit and autoSoftCommit features.- Parameters:
collectionName-- Throws:
Exception
-
addDocument
protected void addDocument(String collection, org.apache.solr.common.SolrInputDocument doc) throws Exception Adds the document to the specified collection but does not issue a commit.- Parameters:
collection-doc-- Throws:
Exception
-
addDocuments
protected void addDocuments(String collection, List<org.apache.solr.common.SolrInputDocument> docs) throws Exception Adds the documents to the specified collection but does not issue a commit.- Parameters:
collection-docs-- Throws:
Exception
-
deleteByQuery
Deletes items for the provided query. This does not issue a commit.- Parameters:
collection-query-- Throws:
Exception
-
deleteByQueries
Deletes items for the provided queries. This does not issue a commit.- Parameters:
collection-queries-- Throws:
Exception
-
deleteByIds
Deletes items by ids. This does not issue a commit.- Parameters:
collection-ids-- Throws:
IOExceptionorg.apache.solr.client.solrj.SolrServerExceptionException
-
getForegroundCollectionName
Description copied from interface:SolrIndexUpdateCommandHandlerThe "live" or customer facing collection (index) name or alias. This should return a non-null, non-empty string. Every invocation should return the same value. (e.g. "catalog").- Specified by:
getForegroundCollectionNamein interfaceSolrIndexUpdateCommandHandler- Returns:
-
getBackgroundCollectionName
Description copied from interface:SolrIndexUpdateCommandHandlerThe background or "offline" collection (index) name or alias. This should return a non-null, non-empty string. Every invocation should return the same value. (e.g. "catalogs_reindex").- Specified by:
getBackgroundCollectionNamein interfaceSolrIndexUpdateCommandHandler- Returns:
-
getSolrConfiguration
-