org.apache.solr.update.processor

## Class UpdateRequestProcessorChain

- java.lang.Object
- - org.apache.solr.update.processor.UpdateRequestProcessorChain

- All Implemented Interfaces:
    PluginInfoInitialized

      public final class UpdateRequestProcessorChain
      extends Object
      implements PluginInfoInitialized

  Manages a chain of UpdateRequestProcessorFactories.

  Chains can be configured via solrconfig.xml using the following syntax...

       <updateRequestProcessorChain name="key" default="true">
         <processor class="package.Class1" />
         <processor class="package.Class2" >
           <str name="someInitParam1">value</str>
           <int name="someInitParam2">42</int>
         </processor>
         <processor class="solr.LogUpdateProcessorFactory" >
           <int name="maxNumToLog">100</int>
         </processor>
         <processor class="solr.RunUpdateProcessorFactory" />
       </updateRequestProcessorChain>

  Multiple Chains can be defined, each with a distinct name. The name of a chain used to handle an update request may be specified using the request param `update.chain`. If no chain is explicitly selected by name, then Solr will attempt to determine a default chain:

  - A single configured chain may explicitly be declared with `default="true"` (see example above)
  - If no chain is explicitly declared as the default, Solr will look for any chain that does not have a name, and treat it as the default
  - As a last resort, Solr will create an implicit default chain consisting of:
    - `LogUpdateProcessorFactory`
    - `DistributedUpdateProcessorFactory`
    - `RunUpdateProcessorFactory`

  Almost all processor chains should end with an instance of `RunUpdateProcessorFactory` unless the user is explicitly executing the update commands in an alternative custom `UpdateRequestProcessorFactory`. If a chain includes `RunUpdateProcessorFactory` but does not include a `DistributingUpdateProcessorFactory`, it will be added automatically by `init()`.

  Since:
    solr 1.3
  See Also:
    `UpdateRequestProcessorFactory`, `init(org.apache.solr.core.PluginInfo)`, `createProcessor(org.apache.solr.request.SolrQueryRequest, org.apache.solr.response.SolrQueryResponse)`

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `UpdateRequestProcessorChain.ProcessorInfo`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `UpdateRequestProcessorChain(List<UpdateRequestProcessorFactory> chain, SolrCore solrCore)` Creates a chain backed directly by the specified list.
    `UpdateRequestProcessorChain(SolrCore solrCore)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static UpdateRequestProcessorChain` | `constructChain(UpdateRequestProcessorChain defaultUrp, UpdateRequestProcessorChain.ProcessorInfo processorInfo, SolrCore core)`
    `UpdateRequestProcessor` | `createProcessor(SolrQueryRequest req, SolrQueryResponse rsp)` Uses the factories in this chain to creates a new `UpdateRequestProcessor` instance specific for this request.
    `List<UpdateRequestProcessorFactory>` | `getProcessors()` Returns the underlying array of factories used in this chain.
    `void` | `init(PluginInfo info)` Initializes the chain using the factories specified by the `PluginInfo`.

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

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

- - ### Constructor Detail

    - #### UpdateRequestProcessorChain

          public UpdateRequestProcessorChain(SolrCore solrCore)

    - #### UpdateRequestProcessorChain

          public UpdateRequestProcessorChain(List<UpdateRequestProcessorFactory> chain,
                                             SolrCore solrCore)

      Creates a chain backed directly by the specified list. Modifications to the array will affect future calls to `createProcessor`

  - ### Method Detail

    - #### init

          public void init(PluginInfo info)

      Initializes the chain using the factories specified by the `PluginInfo`. if the chain includes the `RunUpdateProcessorFactory`, but does not include an implementation of the `DistributingUpdateProcessorFactory` interface, then an instance of `DistributedUpdateProcessorFactory` will be injected immediately prior to the `RunUpdateProcessorFactory`.
      Specified by:
        `init` in interface `PluginInfoInitialized`
      See Also:
        `DistributingUpdateProcessorFactory`, `RunUpdateProcessorFactory`, `DistributedUpdateProcessorFactory`

    - #### createProcessor

          public UpdateRequestProcessor createProcessor(SolrQueryRequest req,
                                                        SolrQueryResponse rsp)

      Uses the factories in this chain to creates a new `UpdateRequestProcessor` instance specific for this request. If the `DISTRIB_UPDATE_PARAM` is present in the request and is non-blank, then any factory in this chain prior to the instance of ``DistributingUpdateProcessorFactory`` will be skipped, except for the log update processor factory.
      See Also:
        `UpdateRequestProcessorFactory.getInstance(org.apache.solr.request.SolrQueryRequest, org.apache.solr.response.SolrQueryResponse, org.apache.solr.update.processor.UpdateRequestProcessor)`, `DistributingUpdateProcessorFactory.DISTRIB_UPDATE_PARAM`

    - #### getProcessors

          public List<UpdateRequestProcessorFactory> getProcessors()

      Returns the underlying array of factories used in this chain. Modifications to the array will affect future calls to `createProcessor`

    - #### constructChain

          public static UpdateRequestProcessorChain constructChain(UpdateRequestProcessorChain defaultUrp,
                                                                   UpdateRequestProcessorChain.ProcessorInfo processorInfo,
                                                                   SolrCore core)

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