Class ParseBooleanFieldUpdateProcessorFactory
- java.lang.Object
-
- org.apache.solr.update.processor.UpdateRequestProcessorFactory
-
- org.apache.solr.update.processor.FieldMutatingUpdateProcessorFactory
-
- 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>
- Since:
- 4.4.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.solr.update.processor.FieldMutatingUpdateProcessorFactory
FieldMutatingUpdateProcessorFactory.SelectorParams
-
Nested classes/interfaces inherited from class org.apache.solr.update.processor.UpdateRequestProcessorFactory
UpdateRequestProcessorFactory.RunAlways
-
-
Constructor Summary
Constructors Constructor Description ParseBooleanFieldUpdateProcessorFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 BoolFieldUpdateRequestProcessor
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
getSelector, inform, parseSelectorExclusionParams, parseSelectorParams
-
-
-
-
Method Detail
-
getInstance
public UpdateRequestProcessor getInstance(SolrQueryRequest req, SolrQueryResponse rsp, UpdateRequestProcessor next)
- Specified by:
getInstance
in classUpdateRequestProcessorFactory
-
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 interfaceNamedListInitializedPlugin
- Overrides:
init
in classFieldMutatingUpdateProcessorFactory
-
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 classFieldMutatingUpdateProcessorFactory
- See Also:
FieldMutatingUpdateProcessor.SELECT_ALL_FIELDS
-
-