org.apache.solr.update.processor

## Class FieldMutatingUpdateProcessorFactory

- java.lang.Object
- - org.apache.solr.update.processor.UpdateRequestProcessorFactory
  - - org.apache.solr.update.processor.FieldMutatingUpdateProcessorFactory

- All Implemented Interfaces:
    NamedListInitializedPlugin, SolrCoreAware
  Direct Known Subclasses:
    ConcatFieldUpdateProcessorFactory, CountFieldValuesUpdateProcessorFactory, FieldLengthUpdateProcessorFactory, FieldValueSubsetUpdateProcessorFactory, HTMLStripFieldUpdateProcessorFactory, IgnoreFieldUpdateProcessorFactory, ParseBooleanFieldUpdateProcessorFactory, ParseDateFieldUpdateProcessorFactory, ParseNumericFieldUpdateProcessorFactory, PreAnalyzedUpdateProcessorFactory, RegexReplaceProcessorFactory, RemoveBlankFieldUpdateProcessorFactory, TrimFieldUpdateProcessorFactory, TruncateFieldUpdateProcessorFactory

      public abstract class FieldMutatingUpdateProcessorFactory
      extends UpdateRequestProcessorFactory
      implements SolrCoreAware

  Base class for implementing Factories for FieldMutatingUpdateProcessors and FieldValueMutatingUpdateProcessors.

  This class provides all of the plumbing for configuring the FieldNameSelector using the following init params to specify selection criteria...

  - `fieldName` - selecting specific fields by field name lookup
  - `fieldRegex` - selecting specific fields by field name regex match (regexes are checked in the order specified)
  - `typeName` - selecting specific fields by fieldType name lookup
  - `typeClass` - selecting specific fields by fieldType class lookup, including inheritence and interfaces

  Each criteria can specified as either an <arr> of <str>, or multiple <str> with the same name. When multiple criteria of a single type exist, fields must match at least one to be selected. If more then one type of criteria exist, fields must match at least one of each to be selected.

  The following additional selector may be specified as a <bool> - when specified as false, only fields that do not match a schema field/dynamic field are selected; when specified as true, only fields that do match a schema field/dynamic field are selected:

  - `fieldNameMatchesSchemaField` - selecting specific fields based on whether or not they match a schema field

  One or more `excludes` <lst> params may also be specified, containing any of the above criteria, identifying fields to be excluded from seelction even if they match the selection criteria. As with the main selection critiera a field must match all of criteria in a single exclusion in order to be excluded, but multiple exclusions may be specified to get an `OR` behavior

  In the ExampleFieldMutatingUpdateProcessorFactory configured below, fields will be mutated if the name starts with "foo" or "bar"; unless the field name contains the substring "SKIP" or the fieldType is (or subclasses) TrieDateField. Meaning a field named "foo_SKIP" is guaranteed not to be selected, but a field named "bar_smith" that uses StrField will be selected.

       <processor class="solr.ExampleFieldMutatingUpdateProcessorFactory">
         <str name="fieldRegex">foo.*</str>
         <str name="fieldRegex">bar.*</str>
         <!-- each set of exclusions is checked independently -->
         <lst name="exclude">
           <str name="fieldRegex">.*SKIP.*</str>
         </lst>
         <lst name="exclude">
           <str name="typeClass">solr.TrieDateField</str>
         </lst>
       </processor>

  Subclasses define the default selection behavior to be applied if no criteria is configured by the user. User configured "exclude" criteria will be applied to the subclass defined default selector.

  See Also:
    `FieldMutatingUpdateProcessor`, `FieldValueMutatingUpdateProcessor`, `FieldMutatingUpdateProcessor.FieldNameSelector`

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `FieldMutatingUpdateProcessorFactory.SelectorParams`

    - ### Nested classes/interfaces inherited from class org.apache.solr.update.processor.UpdateRequestProcessorFactory

      `UpdateRequestProcessorFactory.RunAlways`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FieldMutatingUpdateProcessorFactory()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected FieldMutatingUpdateProcessor.FieldNameSelector` | `getDefaultSelector(SolrCore core)` Defines the default selection behavior when the user has not configured any specific criteria for selecting fields.
    `protected FieldMutatingUpdateProcessor.FieldNameSelector` | `getSelector()`
    `void` | `inform(SolrCore core)`
    `void` | `init(NamedList args)` Handles common initialization related to source fields for constructing the FieldNameSelector to be used.
    `static Collection<FieldMutatingUpdateProcessorFactory.SelectorParams>` | `parseSelectorExclusionParams(NamedList args)`
    `static FieldMutatingUpdateProcessorFactory.SelectorParams` | `parseSelectorParams(NamedList args)`

    - ### Methods inherited from class org.apache.solr.update.processor.UpdateRequestProcessorFactory

      `getInstance`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### FieldMutatingUpdateProcessorFactory

          public FieldMutatingUpdateProcessorFactory()

  - ### Method Detail

    - #### getSelector

          protected final FieldMutatingUpdateProcessor.FieldNameSelector getSelector()

    - #### parseSelectorParams

          public static FieldMutatingUpdateProcessorFactory.SelectorParams parseSelectorParams(NamedList args)

    - #### parseSelectorExclusionParams

          public static Collection<FieldMutatingUpdateProcessorFactory.SelectorParams> parseSelectorExclusionParams(NamedList args)

    - #### init

          public void init(NamedList args)

      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 `UpdateRequestProcessorFactory`

    - #### inform

          public void inform(SolrCore core)

      Specified by:
        `inform` in interface `SolrCoreAware`

    - #### getDefaultSelector

          protected FieldMutatingUpdateProcessor.FieldNameSelector getDefaultSelector(SolrCore core)

      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.
      See Also:
        `FieldMutatingUpdateProcessor.SELECT_ALL_FIELDS`

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