[ 
https://issues.apache.org/jira/browse/SOLR-11631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16250130#comment-16250130
 ] 

Steve Rowe commented on SOLR-11631:
-----------------------------------

Your patch is definitely an improvement [~noble.paul].

With your patch, when I create a schemaless collection with {{bin/solr}} and 
attempt to define the same field twice via {{curl -H 'application/json' 
http://localhost:8983/solr/mycoll/schema -d '\{ add-field: \{ name: mynewfield, 
type: string \}\}'}}, I get the following the second time:

{noformat}
{
  "responseHeader":{
    "status":400,
    "QTime":2},
  "error":{
    "metadata":[
      "error-class","org.apache.solr.api.ApiBag$ExceptionWithErrObject",
      "root-error-class","org.apache.solr.api.ApiBag$ExceptionWithErrObject"],
    "details":[{
        "add-field":{
          "name":"mynewfield",
          "type":"string"},
        "errorMessages":["Field 'mynewfield' already exists.\n"]}],
    "msg":"error processing commands",
    "code":400}}
{noformat}

Which seems reasonable to me, with the exception that the {{error}} key is not 
inside the {{responseHeader}} section, which seems like the right place to me, 
since the error info is metadata, not data.

> Schema API always has status 0
> ------------------------------
>
>                 Key: SOLR-11631
>                 URL: https://issues.apache.org/jira/browse/SOLR-11631
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>            Reporter: Steve Rowe
>         Attachments: SOLR-11631.patch, SOLR-11631.patch
>
>
> Schema API failures always return status=0.
> Consumers should be able to detect failure using normal mechanisms (i.e. 
> status != 0) rather than having to parse the response for "errors".  Right 
> now if I attempt to {{add-field}} an already existing field, I get:
> {noformat}
> {responseHeader={status=0,QTime=XXX},errors=[{add-field={name=YYY, ...}, 
> errorMessages=[Field 'YYY' already exists.]}]}
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to