org.apache.solr.update.processor
Class RegexReplaceProcessorFactory

java.lang.Object
  extended by org.apache.solr.update.processor.UpdateRequestProcessorFactory
      extended by org.apache.solr.update.processor.FieldMutatingUpdateProcessorFactory
          extended by 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.

For example, with the configuration listed below, any sequence of multiple whitespace characters found in values for field named title or content will 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>
 </processor>

See Also:
Pattern

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.solr.update.processor.FieldMutatingUpdateProcessorFactory
FieldMutatingUpdateProcessorFactory.SelectorParams
 
Nested classes/interfaces inherited from class org.apache.solr.update.processor.UpdateRequestProcessorFactory
UpdateRequestProcessorFactory.RunAlways
 
Constructor Summary
RegexReplaceProcessorFactory()
           
 
Method Summary
protected  FieldMutatingUpdateProcessor.FieldNameSelector getDefaultSelector(SolrCore core)
          Defines the default selection behavior when the user has not configured any specific criteria for selecting fields.
 UpdateRequestProcessor getInstance(SolrQueryRequest request, SolrQueryResponse response, UpdateRequestProcessor next)
           
 void init(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.FieldMutatingUpdateProcessorFactory
getBooleanArg, getSelector, inform, oneOrMany, parseSelectorExclusionParams, parseSelectorParams
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RegexReplaceProcessorFactory

public RegexReplaceProcessorFactory()
Method Detail

init

public void init(NamedList args)
Description copied from class: FieldMutatingUpdateProcessorFactory
Handles 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:
init in interface NamedListInitializedPlugin
Overrides:
init in class FieldMutatingUpdateProcessorFactory

getDefaultSelector

protected FieldMutatingUpdateProcessor.FieldNameSelector getDefaultSelector(SolrCore core)
Description copied from class: FieldMutatingUpdateProcessorFactory
Defines 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:
getDefaultSelector in class FieldMutatingUpdateProcessorFactory
See Also:
FieldMutatingUpdateProcessor.SELECT_NO_FIELDS

getInstance

public UpdateRequestProcessor getInstance(SolrQueryRequest request,
                                          SolrQueryResponse response,
                                          UpdateRequestProcessor next)
Specified by:
getInstance in class UpdateRequestProcessorFactory


Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.