org.apache.solr.update.processor
Class ParseBooleanFieldUpdateProcessorFactory

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.ParseBooleanFieldUpdateProcessorFactory
All Implemented Interfaces:
NamedListInitializedPlugin, SolrCoreAware

public class ParseBooleanFieldUpdateProcessorFactory
extends FieldMutatingUpdateProcessorFactory

Attempts to mutate selected fields that have only CharSequence-typed values into Boolean values.

The default selection behavior is to mutate both those fields that don't match a schema field, as well as those fields that do match a schema field and have a field type that uses class solr.BooleanField.

If all values are parseable as boolean (or are already Boolean), then the field will be mutated, replacing each value with its parsed Boolean equivalent; otherwise, no mutation will occur.

The default true and false values are "true" and "false", respectively, and match case-insensitively. The following configuration changes the acceptable values, and requires a case-sensitive match - note that either individual <str> elements or <arr>-s of <str> elements may be used to specify the trueValue-s and falseValue-s:

 <processor class="solr.ParseBooleanFieldUpdateProcessorFactory">
   <str name="caseSensitive">true</str>
   <str name="trueValue">True</str>
   <str name="trueValue">Yes</str>
   <arr name="falseValue">
     <str>False</str>
     <str>No</str>
   <:/arr>
 </processor>


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.solr.update.processor.FieldMutatingUpdateProcessorFactory
FieldMutatingUpdateProcessorFactory.SelectorParams
 
Constructor Summary
ParseBooleanFieldUpdateProcessorFactory()
           
 
Method Summary
 FieldMutatingUpdateProcessor.FieldNameSelector getDefaultSelector(SolrCore core)
          Returns true if the field doesn't match any schema field or dynamic field, or if the matched field's type is BoolField
 UpdateRequestProcessor getInstance(SolrQueryRequest req, SolrQueryResponse rsp, 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

ParseBooleanFieldUpdateProcessorFactory

public ParseBooleanFieldUpdateProcessorFactory()
Method Detail

getInstance

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

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

public FieldMutatingUpdateProcessor.FieldNameSelector getDefaultSelector(SolrCore core)
Returns true if the field doesn't match any schema field or dynamic field, or if the matched field's type is BoolField

Overrides:
getDefaultSelector in class FieldMutatingUpdateProcessorFactory
See Also:
FieldMutatingUpdateProcessor.SELECT_ALL_FIELDS


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