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 incoke 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 @{link org.apache.solr.schema.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.
UUID
UpdateRequestProcessorFactory.RunAlways
Modifier and Type | Field and Description |
---|---|
protected String |
fieldName |
static String |
NAME |
Constructor and Description |
---|
UUIDUpdateProcessorFactory() |
Modifier and Type | Method and Description |
---|---|
UpdateRequestProcessor |
getInstance(SolrQueryRequest req,
SolrQueryResponse rsp,
UpdateRequestProcessor next) |
void |
init(NamedList args) |
public static final String NAME
protected String fieldName
public void init(NamedList args)
init
in interface NamedListInitializedPlugin
init
in class UpdateRequestProcessorFactory
public UpdateRequestProcessor getInstance(SolrQueryRequest req, SolrQueryResponse rsp, UpdateRequestProcessor next)
getInstance
in class UpdateRequestProcessorFactory
Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.