Hello all,

I am using SolrJ to do a index update on one of my collections. This collection has a uniqueKey id field:

  <fields>
    <field name="id" type="string" indexed="true" stored="true"/>
    <field name="_version_" type="long" indexed="true" stored="true"/>
    <field name="name" type="string" indexed="true" stored="true"/>
  </fields>
  <uniqueKey>id</uniqueKey>

This field is configured to be auto generated on solrconfig.xml like this:

<updateRequestProcessorChain>
    <processor class="solr.UUIDUpdateProcessorFactory">
      <str name="fieldName">id</str>
    </processor>
    <processor class="solr.LogUpdateProcessorFactory" />
    <processor class="solr.RunUpdateProcessorFactory" />
</updateRequestProcessorChain>

On my Java code, I just add the name field to my document and then proceed with the add:

doc.addField("name", this.name);
solrClient.add(doc);
solrClient.commit();

Everything works, the document gets indexed. What I really need is to know right away in the code the id that was generated for that single document. I have tried looking into the UpdateReponse but no luck.

Is there any easy way to do that?

Thank you in advance,
Henrique.

Reply via email to