Class UUIDUpdateProcessorFactory
- All Implemented Interfaces:
NamedListInitializedPlugin
UUID value to any document being
added that does not already have a value in the specified field.
In the example configuration below, if a document does not contain a value in the id
field, a new UUID will be generated and added as the value of that field.
<processor class="solr.UUIDUpdateProcessorFactory"> <str name="fieldName">id</str> </processor>
You can also invoke the processor with request handler param(s) as uuid.fieldname
with processor=uuid curl -X POST -H Content-Type: application/json
http://localhost:8983/solr/test/update/json/docs?processor=uuid;ampersand;uuid.fieldName=id;ampersand;commit=true
--data-binary {"id":"1","title": "titleA"}
NOTE: The param(s) provided in request handler will override / supersede processor's config.
If field name is omitted in processor configuration and not provided in request handler
param(s), then IndexSchema.getUniqueKeyField() is used as field
and a new UUID will be generated and added as the value of that field. The field
type of the uniqueKeyField must be anything which accepts a string or UUID value.
- Since:
- 4.0.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.solr.update.processor.UpdateRequestProcessorFactory
UpdateRequestProcessorFactory.RunAlways -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetInstance(SolrQueryRequest req, SolrQueryResponse rsp, UpdateRequestProcessor next) voidinit(org.apache.solr.common.util.NamedList<?> args) initwill be called just once, immediately after creation.
-
Field Details
-
NAME
- See Also:
-
fieldName
-
-
Constructor Details
-
UUIDUpdateProcessorFactory
public UUIDUpdateProcessorFactory()
-
-
Method Details
-
init
public void init(org.apache.solr.common.util.NamedList<?> args) Description copied from interface:NamedListInitializedPlugininitwill be called just once, immediately after creation.Source of the initialization arguments will typically be solrconfig.xml, but will ultimately depends on the plugin itself
- Parameters:
args- non-null list of initialization parameters (may be empty)
-
getInstance
public UpdateRequestProcessor getInstance(SolrQueryRequest req, SolrQueryResponse rsp, UpdateRequestProcessor next) - Specified by:
getInstancein classUpdateRequestProcessorFactory
-