Class UUIDUpdateProcessorFactory

java.lang.Object
org.apache.solr.update.processor.UpdateRequestProcessorFactory
org.apache.solr.update.processor.UUIDUpdateProcessorFactory
All Implemented Interfaces:
NamedListInitializedPlugin

public class UUIDUpdateProcessorFactory extends UpdateRequestProcessorFactory
An update processor that adds a newly generated 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: