Package org.apache.solr.update.processor
Class FieldMutatingUpdateProcessor
java.lang.Object
org.apache.solr.update.processor.UpdateRequestProcessor
org.apache.solr.update.processor.FieldMutatingUpdateProcessor
- All Implemented Interfaces:
Closeable,AutoCloseable
- Direct Known Subclasses:
AllValuesOrNoneFieldMutatingUpdateProcessor,FieldValueMutatingUpdateProcessor
Reusable base class for UpdateProcessors that will consider AddUpdateCommands and mutate the
values associated with configured fields.
Subclasses should override the mutate method to specify how individual SolrInputFields identified by the selector associated with this instance will be mutated.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceInterface for identifying which fields should be mutated -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final FieldMutatingUpdateProcessor.FieldNameSelectorSingleton indicating all fields should be mutatedstatic final FieldMutatingUpdateProcessor.FieldNameSelectorSingleton indicating no fields should be mutatedFields inherited from class org.apache.solr.update.processor.UpdateRequestProcessor
next -
Constructor Summary
ConstructorsConstructorDescriptionFieldMutatingUpdateProcessor(FieldMutatingUpdateProcessor.FieldNameSelector selector, UpdateRequestProcessor next) -
Method Summary
Modifier and TypeMethodDescriptioncreateFieldNameSelector(SolrResourceLoader loader, SolrCore core, FieldMutatingUpdateProcessorFactory.SelectorParams params, FieldMutatingUpdateProcessor.FieldNameSelector defSelector) Utility method that can be used to define a FieldNameSelector using the same types of rules as the FieldMutatingUpdateProcessor init code.createFieldNameSelector(SolrResourceLoader loader, IndexSchema schema, FieldMutatingUpdateProcessorFactory.SelectorParams params, FieldMutatingUpdateProcessor.FieldNameSelector defSelector) Utility method that can be used to define a FieldNameSelector using the same types of rules as the FieldMutatingUpdateProcessor init code.protected abstract org.apache.solr.common.SolrInputFieldmutate(org.apache.solr.common.SolrInputField src) Method for mutating SolrInputFields associated with fields identified by the FieldNameSelector associated with this processorstatic FieldMutatingUpdateProcessormutator(FieldMutatingUpdateProcessor.FieldNameSelector selector, UpdateRequestProcessor next, Function<org.apache.solr.common.SolrInputField, org.apache.solr.common.SolrInputField> fun) voidCallsmutateon any fields identified by the selector before forwarding the command down the chain.wrap(FieldMutatingUpdateProcessor.FieldNameSelector includes, FieldMutatingUpdateProcessor.FieldNameSelector excludes) Wraps two FieldNameSelectors such that the FieldNameSelector returned matches all fields specified by the "includes" unless they are matched by "excludes"Methods inherited from class org.apache.solr.update.processor.UpdateRequestProcessor
close, doClose, finish, processCommit, processDelete, processMergeIndexes, processRollback
-
Field Details
-
SELECT_ALL_FIELDS
Singleton indicating all fields should be mutated -
SELECT_NO_FIELDS
Singleton indicating no fields should be mutated
-
-
Constructor Details
-
FieldMutatingUpdateProcessor
public FieldMutatingUpdateProcessor(FieldMutatingUpdateProcessor.FieldNameSelector selector, UpdateRequestProcessor next)
-
-
Method Details
-
mutate
protected abstract org.apache.solr.common.SolrInputField mutate(org.apache.solr.common.SolrInputField src) Method for mutating SolrInputFields associated with fields identified by the FieldNameSelector associated with this processor- Parameters:
src- the SolrInputField to mutate, may be modified in place and returned- Returns:
- the SolrInputField to use in replacing the original (src) value. If null the field will be removed.
-
processAdd
Callsmutateon any fields identified by the selector before forwarding the command down the chain. Any SolrExceptions thrown bymutatewill be logged with the Field name, wrapped and re-thrown.- Overrides:
processAddin classUpdateRequestProcessor- Throws:
IOException
-
wrap
public static FieldMutatingUpdateProcessor.FieldNameSelector wrap(FieldMutatingUpdateProcessor.FieldNameSelector includes, FieldMutatingUpdateProcessor.FieldNameSelector excludes) Wraps two FieldNameSelectors such that the FieldNameSelector returned matches all fields specified by the "includes" unless they are matched by "excludes"- Parameters:
includes- a selector identifying field names that should be selectedexcludes- a selector identifying field names that should be not be selected, even if they are matched by the 'includes' selector- Returns:
- Either a new FieldNameSelector or one of the input selectors if the combination lends itself to optimization.
-
createFieldNameSelector
public static FieldMutatingUpdateProcessor.FieldNameSelector createFieldNameSelector(SolrResourceLoader loader, SolrCore core, FieldMutatingUpdateProcessorFactory.SelectorParams params, FieldMutatingUpdateProcessor.FieldNameSelector defSelector) Utility method that can be used to define a FieldNameSelector using the same types of rules as the FieldMutatingUpdateProcessor init code. This may be useful for Factories that wish to define default selectors in similar terms to what the configuration would look like.- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
-
createFieldNameSelector
public static FieldMutatingUpdateProcessor.FieldNameSelector createFieldNameSelector(SolrResourceLoader loader, IndexSchema schema, FieldMutatingUpdateProcessorFactory.SelectorParams params, FieldMutatingUpdateProcessor.FieldNameSelector defSelector) Utility method that can be used to define a FieldNameSelector using the same types of rules as the FieldMutatingUpdateProcessor init code. This may be useful for Factories that wish to define default selectors in similar terms to what the configuration would look like. Usesschemafor checking field existence.- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
-
mutator
public static FieldMutatingUpdateProcessor mutator(FieldMutatingUpdateProcessor.FieldNameSelector selector, UpdateRequestProcessor next, Function<org.apache.solr.common.SolrInputField, org.apache.solr.common.SolrInputField> fun)
-