Package org.apache.solr.update.processor
Class RegexReplaceProcessorFactory
- java.lang.Object
- 
- org.apache.solr.update.processor.UpdateRequestProcessorFactory
- 
- org.apache.solr.update.processor.FieldMutatingUpdateProcessorFactory
- 
- org.apache.solr.update.processor.RegexReplaceProcessorFactory
 
 
 
- 
- All Implemented Interfaces:
- NamedListInitializedPlugin,- SolrCoreAware
 
 public final class RegexReplaceProcessorFactory extends FieldMutatingUpdateProcessorFactory An updated processor that applies a configured regex to any CharSequence values found in the selected fields, and replaces any matches with the configured replacement string.By default this processor applies itself to no fields. By default, literalReplacementis set to true, in which case, thereplacementstring will be treated literally by quoting viaMatcher.quoteReplacement(String). And hence, '\' and '$' signs will not be processed. WhenliteralReplacementis set to false, one can perform backreference operations and capture group substitutions.For example, with the configuration listed below, any sequence of multiple whitespace characters found in values for field named titleorcontentwill be replaced by a single space character.<processor class="solr.RegexReplaceProcessorFactory"> <str name="fieldName">content</str> <str name="fieldName">title</str> <str name="pattern">\s+</str> <str name="replacement"> </str> <bool name="literalReplacement">true</bool> </processor> - Since:
- 4.0.0
- See Also:
- Pattern
 
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from class org.apache.solr.update.processor.FieldMutatingUpdateProcessorFactoryFieldMutatingUpdateProcessorFactory.SelectorParams
 - 
Nested classes/interfaces inherited from class org.apache.solr.update.processor.UpdateRequestProcessorFactoryUpdateRequestProcessorFactory.RunAlways
 
- 
 - 
Constructor SummaryConstructors Constructor Description RegexReplaceProcessorFactory()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected FieldMutatingUpdateProcessor.FieldNameSelectorgetDefaultSelector(SolrCore core)Defines the default selection behavior when the user has not configured any specific criteria for selecting fields.UpdateRequestProcessorgetInstance(SolrQueryRequest request, SolrQueryResponse response, UpdateRequestProcessor next)voidinit(org.apache.solr.common.util.NamedList<?> args)Handles common initialization related to source fields for constructing the FieldNameSelector to be used.- 
Methods inherited from class org.apache.solr.update.processor.FieldMutatingUpdateProcessorFactorygetSelector, inform, parseSelectorExclusionParams, parseSelectorParams
 
- 
 
- 
- 
- 
Method Detail- 
initpublic void init(org.apache.solr.common.util.NamedList<?> args) Description copied from class:FieldMutatingUpdateProcessorFactoryHandles common initialization related to source fields for constructing the FieldNameSelector to be used.Will error if any unexpected init args are found, so subclasses should remove any subclass-specific init args before calling this method. - Specified by:
- initin interface- NamedListInitializedPlugin
- Overrides:
- initin class- FieldMutatingUpdateProcessorFactory
- Parameters:
- args- non-null list of initialization parameters (may be empty)
 
 - 
getDefaultSelectorprotected FieldMutatingUpdateProcessor.FieldNameSelector getDefaultSelector(SolrCore core) Description copied from class:FieldMutatingUpdateProcessorFactoryDefines the default selection behavior when the user has not configured any specific criteria for selecting fields. The Default implementation matches all fields, and should be overridden by subclasses as needed.- Overrides:
- getDefaultSelectorin class- FieldMutatingUpdateProcessorFactory
- See Also:
- FieldMutatingUpdateProcessor.SELECT_NO_FIELDS
 
 - 
getInstancepublic UpdateRequestProcessor getInstance(SolrQueryRequest request, SolrQueryResponse response, UpdateRequestProcessor next) - Specified by:
- getInstancein class- UpdateRequestProcessorFactory
 
 
- 
 
-