You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Susmit Shukla <sh...@gmail.com> on 2016/04/12 23:59:49 UTC

Question regarding empty UUID field

Hi,

I have configured solr schema to generate unique id for a collection using
UUIDUpdateProcessorFactory

I am seeing a peculiar behavior - if the unique 'id' field is explicitly
set as empty string in the SolrInputDocument, the document gets indexed. I
can see in the solr query console a good uuid value was generated by solr
and assigned to id.
However, sorting does not work if uuid was generated in this way. Also
cursor functionality that depends on unique id sort also does not work.
I guess the correct behavior would be to fail the indexing if user provides
an empty string for a uuid field.

The issues do not happen if I omit the id field from the SolrInputDocument .

SolrInputDocument

solrDoc.addField("id", "");

...

I am using schema similar to below-

<!--schema.xml-->

<fieldType name="uuid" class="solr.UUIDField" indexed="true" />

<field name="id" type="uuid" indexed="true" stored="true" required="true" />

<uniqueKey>id</uniqueKey>

<!--solrconfig.xml-->
<updateRequestProcessorChain name="uuid">
    <processor class="solr.UUIDUpdateProcessorFactory">
      <str name="fieldName">id</str>
    </processor>
    <processor class="solr.RunUpdateProcessorFactory" />
</updateRequestProcessorChain>


 <requestHandler name="/update" class="solr.UpdateRequestHandler">
       <lst name="defaults">
         <str name="update.chain">uuid</str>
       </lst>
</requestHandler>


Thanks,
Susmit