Hi,

I'm trying to build a simple document search core with SolrCloud. I've run
into an issue when trying to partially update doucments. (aka atomic
updates) It appears to be a bug, because the semantically same request
succeeds in XML format, while it fails as JSON.

The body of the XML request:
<add><doc><field name="id">test1</field><field name="title"
update="set">Solr Rocks</field></doc></add>

The body of the JSON request:
{"id":"test1","title":{"set":"Solr Rocks"}}

I'm using the requests library in Python3 to send the update request.
Sending the XML request with the following code works as expected:
r = requests.post('
http://localhost:8983/v2/c/testnode/update/xml?commit=true',
headers={'Content-type': 'application/xml'}, data=xml)

Sending the JSON request with the following codes return with a
SolrException:
r = requests.post('
http://localhost:8983/v2/c/testnode/update/json?commit=true',
headers={'Content-type': 'application/json'}, data=json)
r = requests.post('
http://localhost:8983/solr/testnode/update/json/docs?commit=true',
headers={'Content-type': 'application/json'}, data=json)

Using the same lines of code to send a JSON request that is not an atomic
update works as expected. Such JSON request body is like:
{"id":"test1","title":"Solr Rocks"}

The error message in the response is: ERROR: [doc=test1] unknown field
'title.set'
Here is the log of the exception: https://pastebin.com/raw/VJe5hR25

Depending on which API I send the request to, the logs are identical except
on line 27 and 28:
This is with v2:
  at
org.apache.solr.handler.UpdateRequestHandlerApi$1.call(UpdateRequestHandlerApi.java:48)
  at org.apache.solr.api.V2HttpCall.execute(V2HttpCall.java:325)
and this is with the other:
  at org.apache.solr.core.SolrCore.execute(SolrCore.java:2503)
  at org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:711)

I'm using Solr 7.3.1 and I believe I do everything according to the
documentation. (
https://lucene.apache.org/solr/guide/7_3/updating-parts-of-documents.html#atomic-updates
)
The solrconfig.xml and managed-schema files are fairly simple, they have
code snippets from the examples mostly: https://pastebin.com/199JJkp0
https://pastebin.com/Dp1YK46k

This could be a bug, or I can't fathom what I'm missing. Can anyone help me
out?
Thanks,
Nandor

Reply via email to