lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Solr Wiki] Update of "UpdateRequestProcessor" by HossMan
Date Thu, 26 Jul 2012 01:23:05 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.

The "UpdateRequestProcessor" page has been changed by HossMan:
http://wiki.apache.org/solr/UpdateRequestProcessor?action=diff&rev1=13&rev2=14

Comment:
elaborate on RunUpdateProcessor and DistributedUpdateProcessor

- <!> [[Solr1.3]]
+ /!\ [[Solr1.3]]
  
- The [[http://lucene.apache.org/solr/api/org/apache/solr/update/processor/UpdateRequestProcessor.html|UpdateRequestProcessor]]
defines how an update request is processed before it is indexed by the update handler.
+ [[http://lucene.apache.org/solr/api/org/apache/solr/update/processor/UpdateRequestProcessor.html|UpdateRequestProcessors]]
can be mixed and matched in [[http://lucene.apache.org/solr/api/org/apache/solr/update/processor/UpdateRequestProcessorChain.html|UpdateRequestProcessorChains]]
that define how update requests  are processed.
  
+ <<TableOfContents()>>
+ 
- == Configuring UpdateRequestProcessors ==
+ = Configuring Update Request Processors =
+ 
- solrconfig.xml will load a UpdateRequestProcessorChain
+ solrconfig.xml files can contain any number of !UpdateRequestProcessorChains...
  
  {{{
   <updateRequestProcessorChain name="mychain" >
@@ -15, +18 @@

         <str name="n2">x2</str>
       </lst>
     </processor>
+    <processor class="solr.LogUpdateProcessorFactory" />
     <processor class="solr.RunUpdateProcessorFactory" />
-    <processor class="solr.LogUpdateProcessorFactory" />
   </updateRequestProcessorChain>
  }}}
  
+ Allmost all processor chains should end with an instance of {{{RunUpdateProcessorFactory}}}
unless the user is explicitly executing the update commands in an alternative custom {{{!UpdateRequestProcessorFactory}}}.
+ 
- == Selecting the UpdateChain for your request ==
+ = Selecting the UpdateChain for Your Request =
- Once one or more update chains are defined, you may select one on the update request through
the parameter {{{update.chain}}} ( <!> Note that for pre-[[Solr3.2]] you need to use
{{{update.processor}}} instead). Example: {{{http://localhost:8983/solr/update/xml?update.chain=mychain}}}.
You may also choose to set a default UpdateChain for a certain UpdateRequestHandler:
+ 
+ Once one or more update chains are defined, you may select one on the update request through
the parameter {{{update.chain}}} 
+ 
+ Example: {{{http://localhost:8983/solr/update/xml?update.chain=mychain}}}. 
+ 
+ <!> '''Note:''' for Solr versions prior to [[Solr3.2]] you need to use {{{update.processor}}}
instead <!>
+ 
+ You may also choose to set a default chain for a certain UpdateRequestHandler:
  {{{
   <!-- referencing it in an update handler -->
   <requestHandler name="/update/processortest" class="solr.JsonUpdateRequestHandler" >
@@ -31, +43 @@

   </requestHandler>
  }}}
  
+ = Distributed Updates =
+ 
+ Begining with [[Solr4.0]] all !UpdateRequestProcessorChains which include {{{RunUpdateProcessorFactory}}},
but do not include an implementation of the [[http://lucene.apache.org/solr/api/org/apache/solr/update/processor/DistributingUpdateProcessorFactory.html|DistributingUpdateProcessorFactory]]
will have an instance of {{{DistributedUpdateProcessorFactory}}} automaticly injected immediately
prior to the {{{RunUpdateProcessorFactory}}}.
+ 
+ In single-server instances, {{{DistributedUpdateProcessorFactory}}} is a No-Op, but for
Solr Cloud instances, it determines where the in the chain the request gets forwarded to the
leader (and other all other nodes in the shard). Processors prior to {{{DistributedUpdateProcessorFactory}}}
in the chain will be executed only on the first node to recieve the command, processors after
the {{{DistributedUpdateProcessorFactory}}} will be executed on every node in the appropriate
shard(s).
+ 
+ = Processor Customization Examples =
+ 
+ == Field Mutating Update Processors ==
+ 
+ Beginging with [[Solr4.0]] various [[http://lucene.apache.org/solr/api/org/apache/solr/update/processor/FieldMutatingUpdateProcessorFactory.html|FieldMutatingUpdateProcessorFactories]]
are available that can be mixed and matched to accomplish a variety of goals.
+ 
  == Implementing a conditional copyField ==
+ 
  Here is a quick example that adds the 'cat' 'popular' if the value of 'popularity' is >
5
  
  {{{
@@ -79, +104 @@

  }
  }}}
  
- === ScriptUpdateProcessor ===
+ == Script UpdateProcessors ==
  
  [[https://issues.apache.org/jira/browse/SOLR-1725|SOLR-1725]], to be committed for Solr
4.0 final release, adds a ScriptUpdateProcessor.  There is a StatelessScriptUpdateProcessorFactory
included to configure into your solrconfig.xml configuration file.  The ScriptUpdateProcessor
allows for Java scripting engines to be used during the Solr document update processing, allowing
dramatic flexibility in expressing custom document processing before being indexed.  (it also
allows hooks to commit, delete, etc, but add will have the most common usage).  More coming
soon!
  

Mime
View raw message