Class AbstractSearchIndexingProcessor
java.lang.Object
org.craftercms.deployer.impl.processors.AbstractDeploymentProcessor
org.craftercms.deployer.impl.processors.AbstractMainDeploymentProcessor
org.craftercms.deployer.impl.processors.AbstractSearchIndexingProcessor
- All Implemented Interfaces:
DeploymentProcessor,InitializableByConfigBean,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanNameAware
- Direct Known Subclasses:
OpenSearchIndexingProcessor
Processor that indexes the files on the change set, using one or several
BatchIndexer. After the files have
been indexed it submits a commit. A processor instance can be configured with the following YAML properties:
- ignoreIndexId: If the index ID should be ignored, in other words, if the index ID should always be null on update calls.
- indexId: The specific index ID to use
- reindexItemsOnComponentUpdates: Flag that indicates that if a component is updated, all other pages and components that include it should be updated too. This needs to be done when flattening is enabled, since the component needs to be re-included in pages/components. By default is true.
- Author:
- avasquez
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List<org.craftercms.search.batch.BatchIndexer> protected org.craftercms.core.util.cache.CacheTemplateprotected Patternprotected org.craftercms.core.service.ContentStoreServiceprotected org.springframework.beans.factory.ObjectFactory<org.craftercms.core.service.Context> protected static final Stringprotected booleanprotected static final Patternprotected static final Patternprotected static final intprotected Patternprotected static final Stringprotected static final Stringprotected Stringprotected Stringprotected intprotected static final Stringprotected booleanprotected booleanFields inherited from class org.craftercms.deployer.impl.processors.AbstractMainDeploymentProcessor
FAIL_DEPLOYMENT_CONFIG_KEY, failDeploymentOnFailureFields inherited from class org.craftercms.deployer.impl.processors.AbstractDeploymentProcessor
alwaysRun, env, excludeFiles, includeFiles, JUMPING_TO_PARAM_NAME, jumpTo, label, name, siteName, targetId -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddAffectedItemsToUpdatedFiles(String path, List<String> createdFiles, List<String> updatedFiles, List<String> deletedFiles, BiFunction<String, String, List<String>> function) protected voidaddItemsThatIncludeComponentToUpdatedFiles(String componentPath, List<String> createdFiles, List<String> updatedFiles, List<String> deletedFiles) protected voidaddItemsThatInheritFromDescriptorToUpdatedFiles(String descriptorPath, List<String> createdFiles, List<String> updatedFiles, List<String> deletedFiles) protected abstract voidprotected abstract voidprotected voidAllows extending classes perform any custom cleanupprotected voiddoInit(org.apache.commons.configuration2.Configuration config) Allows extending classes perform any custom initializationprotected ChangeSetdoMainProcess(Deployment deployment, ProcessorExecution execution, ChangeSet filteredChangeSet, ChangeSet originalChangeSet) protected ChangeSetexpandChangeSet(ChangeSet changeSet) Expand changeSet by adding pages/components that need to be updated because a component that they include was updated.getItemsThatIncludeComponent(String indexId, String componentPath) getItemsThatInheritDescriptor(String indexId, String descriptorPath) protected booleanisBeingUpdatedOrDeleted(String path, List<String> createdFiles, List<String> updatedFiles, List<String> deletedFiles) protected booleanisComponent(String path) protected booleanisDescriptor(String path) voidsetBatchIndexer(org.craftercms.search.batch.BatchIndexer batchIndexer) Sets the single batch indexer used for indexing.voidsetBatchIndexers(List<org.craftercms.search.batch.BatchIndexer> batchIndexers) Sets the list of batch indexers used for indexing.voidsetCacheTemplate(org.craftercms.core.util.cache.CacheTemplate cacheTemplate) voidsetComponentPathRegex(String componentPathRegex) Sets the regex used to match component paths (used whenreindexItemsOnComponentUpdatesis enabled).voidsetContentStoreService(org.craftercms.core.service.ContentStoreService contentStoreService) Sets the content store used to retrieve the files to index.voidsetContextFactory(org.springframework.beans.factory.ObjectFactory<org.craftercms.core.service.Context> contextFactory) Sets the factory for theContext.voidsetDescriptorPathRegex(String descriptorPathRegex) Sets the regex used to match descriptor paths for detecting inheriting items that should be reindex.voidsetIndexIdFormat(String indexIdFormat) The format used for the index idvoidsetItemsThatIncludeComponentQueryRows(int itemsThatIncludeComponentQueryRows) Sets the rows to fetch for the search query used to find items that include components (used whenreindexItemsOnComponentUpdatesis enabled).voidsetXmlFlatteningEnabled(boolean xmlFlatteningEnabled) Sets whether XML flattening is enabled.booleansupportsMode(Deployment.Mode mode) Indicates if the processor should be included in the given deployment modeMethods inherited from class org.craftercms.deployer.impl.processors.AbstractMainDeploymentProcessor
doExecute, failDeploymentOnProcessorFailure, init, shouldExecuteMethods inherited from class org.craftercms.deployer.impl.processors.AbstractDeploymentProcessor
destroy, execute, getDeploymentParam, getFilteredChangeSet, isJumpToActive, isPostDeployment, setBeanName, setEnv, setSiteName, setTargetId, shouldIncludeFile, startJumpTo
-
Field Details
-
INDEX_ID_CONFIG_KEY
- See Also:
-
IGNORE_INDEX_ID_CONFIG_KEY
- See Also:
-
REINDEX_ITEMS_ON_COMPONENT_UPDATES
- See Also:
-
CREATE_INDEX_IF_MISSING_CONFIG_KEY
- See Also:
-
DEFAULT_DESCRIPTOR_PATH_PATTERN
-
DEFAULT_COMPONENT_PATH_PATTERN
-
DEFAULT_ITEMS_THAT_INCLUDE_COMPONENT_QUERY_ROWS
protected static final int DEFAULT_ITEMS_THAT_INCLUDE_COMPONENT_QUERY_ROWS- See Also:
-
cacheTemplate
protected org.craftercms.core.util.cache.CacheTemplate cacheTemplate -
contextFactory
protected org.springframework.beans.factory.ObjectFactory<org.craftercms.core.service.Context> contextFactory -
contentStoreService
protected org.craftercms.core.service.ContentStoreService contentStoreService -
batchIndexers
-
xmlFlatteningEnabled
protected boolean xmlFlatteningEnabled -
descriptorPathPattern
-
componentPathPattern
-
itemsThatIncludeComponentQueryRows
protected int itemsThatIncludeComponentQueryRows -
indexIdFormat
-
indexId
-
reindexItemsOnComponentUpdates
protected boolean reindexItemsOnComponentUpdates -
createIndexIfMissing
protected boolean createIndexIfMissing
-
-
Constructor Details
-
AbstractSearchIndexingProcessor
public AbstractSearchIndexingProcessor()
-
-
Method Details
-
setCacheTemplate
public void setCacheTemplate(org.craftercms.core.util.cache.CacheTemplate cacheTemplate) -
setContextFactory
public void setContextFactory(org.springframework.beans.factory.ObjectFactory<org.craftercms.core.service.Context> contextFactory) Sets the factory for theContext. -
setContentStoreService
public void setContentStoreService(org.craftercms.core.service.ContentStoreService contentStoreService) Sets the content store used to retrieve the files to index. -
setBatchIndexer
public void setBatchIndexer(org.craftercms.search.batch.BatchIndexer batchIndexer) Sets the single batch indexer used for indexing. -
setBatchIndexers
Sets the list of batch indexers used for indexing. -
setXmlFlatteningEnabled
public void setXmlFlatteningEnabled(boolean xmlFlatteningEnabled) Sets whether XML flattening is enabled. Only used in conjunction withreindexItemsOnComponentUpdatesto see if pages/components should be re-indexed when components they include are updated. -
setDescriptorPathRegex
Sets the regex used to match descriptor paths for detecting inheriting items that should be reindex. -
setComponentPathRegex
Sets the regex used to match component paths (used whenreindexItemsOnComponentUpdatesis enabled). -
setItemsThatIncludeComponentQueryRows
public void setItemsThatIncludeComponentQueryRows(int itemsThatIncludeComponentQueryRows) Sets the rows to fetch for the search query used to find items that include components (used whenreindexItemsOnComponentUpdatesis enabled). -
setIndexIdFormat
The format used for the index id -
doInit
protected void doInit(org.apache.commons.configuration2.Configuration config) throws org.craftercms.commons.config.ConfigurationException Description copied from class:AbstractDeploymentProcessorAllows extending classes perform any custom initialization- Specified by:
doInitin classAbstractDeploymentProcessor- Parameters:
config- the bean's configuration- Throws:
org.craftercms.commons.config.ConfigurationException- if there's configuration related exception
-
doDestroy
Description copied from class:AbstractDeploymentProcessorAllows extending classes perform any custom cleanup- Specified by:
doDestroyin classAbstractDeploymentProcessor- Throws:
DeployerException- if an error occurs
-
supportsMode
Description copied from interface:DeploymentProcessorIndicates if the processor should be included in the given deployment mode- Specified by:
supportsModein interfaceDeploymentProcessor- Overrides:
supportsModein classAbstractDeploymentProcessor- Parameters:
mode- the deployment mode to check- Returns:
- true if the processor should be included
-
doCreateIndexIfMissing
protected abstract void doCreateIndexIfMissing() -
expandChangeSet
Expand changeSet by adding pages/components that need to be updated because a component that they include was updated.- Parameters:
changeSet- original change set- Returns:
- filtered change set
-
doMainProcess
protected ChangeSet doMainProcess(Deployment deployment, ProcessorExecution execution, ChangeSet filteredChangeSet, ChangeSet originalChangeSet) throws DeployerException Description copied from class:AbstractMainDeploymentProcessorPerforms the actual work of processing the files in theChangeSet, it is also possible to return a newChangeSetto be used for the following processors in the pipeline- Specified by:
doMainProcessin classAbstractMainDeploymentProcessor- Parameters:
deployment- the current deploymentexecution- the current executionfilteredChangeSet- the filtered change set (as returned byAbstractDeploymentProcessor.getFilteredChangeSet(ChangeSet))originalChangeSet- the original change set (as returned by the previous processors in the pipeline)- Returns:
- a new
ChangeSetor null - Throws:
DeployerException- if there is any error processing theChangeSet
-
doCommit
-
isDescriptor
-
isComponent
-
isBeingUpdatedOrDeleted
-
getItemsThatInheritDescriptor
-
addItemsThatInheritFromDescriptorToUpdatedFiles
-
getItemsThatIncludeComponent
-
addItemsThatIncludeComponentToUpdatedFiles
-
addAffectedItemsToUpdatedFiles
-