org.apache.solr.update.processor
Class CloneFieldUpdateProcessorFactory

java.lang.Object
  extended by org.apache.solr.update.processor.UpdateRequestProcessorFactory
      extended by org.apache.solr.update.processor.CloneFieldUpdateProcessorFactory
All Implemented Interfaces:
NamedListInitializedPlugin, SolrCoreAware

public class CloneFieldUpdateProcessorFactory
extends UpdateRequestProcessorFactory
implements SolrCoreAware

Clones the values found in any matching source field into the configured dest field.

While the dest field must be a single <str>, the source fields can be configured as either:

If the dest field already exists in the document, then the values from the source fields will be added to it. The "boost" value associated with the dest will not be changed, and any boost specified on the source fields will be ignored. (If the dest field did not exist prior to this processor, the newly created dest field will have the default boost of 1.0)

In the example below, the category field will be cloned into the category_s field, both the authors and editors fields will be cloned into the contributors field, and any field with a name ending in _price -- except for list_price -- will be cloned into the all_prices field.

   <updateRequestProcessorChain name="multiple-clones">
     <processor class="solr.CloneFieldUpdateProcessorFactory">
       <str name="source">category</str>
       <str name="dest">category_s</str>
     </processor>
     <processor class="solr.CloneFieldUpdateProcessorFactory">
       <arr name="source">
         <str>authors</str>
         <str>editors</str>
       </arr>
       <str name="dest">contributors</str>
     </processor>
     <processor class="solr.CloneFieldUpdateProcessorFactory">
       <lst name="source">
         <str name="fieldRegex">.*_price</str>
         <lst name="exclude">
           <str name="fieldName">list_price</str>
         </lst>
       </lst>
       <str name="dest">all_prices</str>
     </processor>
   </updateRequestProcessorChain>
 


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.solr.update.processor.UpdateRequestProcessorFactory
UpdateRequestProcessorFactory.RunAlways
 
Field Summary
static String DEST_PARAM
           
static String SOURCE_PARAM
           
 
Constructor Summary
CloneFieldUpdateProcessorFactory()
           
 
Method Summary
 UpdateRequestProcessor getInstance(SolrQueryRequest req, SolrQueryResponse rsp, UpdateRequestProcessor next)
           
protected  FieldMutatingUpdateProcessor.FieldNameSelector getSourceSelector()
           
 void inform(SolrCore core)
           
 void init(NamedList args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SOURCE_PARAM

public static final String SOURCE_PARAM
See Also:
Constant Field Values

DEST_PARAM

public static final String DEST_PARAM
See Also:
Constant Field Values
Constructor Detail

CloneFieldUpdateProcessorFactory

public CloneFieldUpdateProcessorFactory()
Method Detail

getSourceSelector

protected final FieldMutatingUpdateProcessor.FieldNameSelector getSourceSelector()

init

public void init(NamedList args)
Specified by:
init in interface NamedListInitializedPlugin
Overrides:
init in class UpdateRequestProcessorFactory

inform

public void inform(SolrCore core)
Specified by:
inform in interface SolrCoreAware

getInstance

public final UpdateRequestProcessor getInstance(SolrQueryRequest req,
                                                SolrQueryResponse rsp,
                                                UpdateRequestProcessor next)
Specified by:
getInstance in class UpdateRequestProcessorFactory


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