On 10/29/2018 7:40 AM, Zahra Aminolroaya wrote:
Thanks Alex. I want to have a query for atomic update with solrj like below:

http://localhost:8983/solr/test4/update?preprocessor=atomic&atomic.text2=set&atomic.text=set&atomic.text3=set&commit=true&stream.body=%3Cadd%3E%3Cdoc%3E%3Cfield%20name=%22id%22%3E11%3C/field%3E%3Cfield%20name=%22text3%22%20update=%22set%22%3Ehi%3C/field%3E%3C/doc%3E%3C/add%3E

Noted.  Is this a URL that works?  I have never heard of these parameters that you are using.  Can you point me at documentation for them?

First, in solrj, I used "setfield" instead of "addfield" like
doc.setField("text3", "hi");

Then, I added ModifiableSolrParams :

ModifiableSolrParams add = new ModifiableSolrParams()
                     .add("processor", "atomic")
                     .add("atomic.text", "set")
                     .add("atomic.text2", "set")
                     .add("atomic.text3", "set")
                     .add(UpdateParams.COMMIT, "true")
                     .add("commit","true");

In the URL you used "preprocessor" but here you are using "processor".  Which is it?  The other parameters look just like what you have on the URL.  If the parameters are valid for the /update handler, it should work once you change processor to preprocessor.

Thanks,
Shawn

Reply via email to