Hi Henrique, I don't believe there's an easy way to do that. As you noticed, the SolrInputDocument is not an I/O param, that is, it is not sent back once data has been indexed and this is good, because here you're sending just one document, but imagine what could happen if you do a bulk loading...the response would be very very huge!
Although I could imagine some workaround (with a custom UpdateRequestProcessor and a custom ResponseWriter), the point is that (see above) I believe it would end in a bad design: - if you send one document at time this is *often* considered a bad practice; - if you send a lot of data the corresponding response would be huge, it will contains a lot of new created identifiers....and BTW how do you match them with your input documents? Sequentially? mmmm....in this way you won't be able to use any *asynch* client Personally, if that is ok for your context, I'd completely avoid the problem moving the logic on the client side. I mean, create a UUID field on Solrj and add that ID to the outcoming document. Best, Andrea 2015-08-06 21:39 GMT+02:00 Henrique O. Santos <hensan...@gmail.com>: > 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. >