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 newUUID
will be generated and added as the value of that field.
<processor class="solr.UUIDUpdateProcessorFactory"> <str name="fieldName">id</str> </processor>
You can also incoke the processor with request handler param(s) as
uuid.fieldname
withprocessor=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 @{link org.apache.solr.schema.IndexSchema#getUniqueKeyField()} is used as field and a newUUID
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:
UUID
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.solr.update.processor.UpdateRequestProcessorFactory
UpdateRequestProcessorFactory.RunAlways
-
-
Constructor Summary
Constructors Constructor Description UUIDUpdateProcessorFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description UpdateRequestProcessor
getInstance(SolrQueryRequest req, SolrQueryResponse rsp, UpdateRequestProcessor next)
void
init(NamedList args)
-
-
-
Field Detail
-
NAME
public static final String NAME
- See Also:
- Constant Field Values
-
fieldName
protected String fieldName
-
-
Method Detail
-
init
public void init(NamedList args)
- Specified by:
init
in interfaceNamedListInitializedPlugin
- Overrides:
init
in classUpdateRequestProcessorFactory
-
getInstance
public UpdateRequestProcessor getInstance(SolrQueryRequest req, SolrQueryResponse rsp, UpdateRequestProcessor next)
- Specified by:
getInstance
in classUpdateRequestProcessorFactory
-
-