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

Ryan McKinley commented on SOLR-945:
------------------------------------

Re: API revist...

For better or worse, this patch matches the JSON format with the 
XXXUpdateCommand classes.  Unlike XML, each add document requires a new add 
statement.  I did this since adding the document boost gets really clumsy.

{code}
"add": {
  "commitWithin": 1234,
  "overwrite": false,
  "boost": 3.45,
  "doc": {
    "f1": "v1",
    "f1": "v2"
  }
{code}

Adding the document boost to your example gets a bit ugly:
{code}
"docs":[
     { "boost": 2,
        "fields": { "f0": "v0",  "f1": 2.4 }
     },
     { "boost": 3,
        "fields": { "f0": "v0",  "f1": 2.4 }
     },
  ]
{code}

Personally, I like having the entire command encompassed in JSON rather then 
spreading it between the query args and the post body.  I like this since all 
commands can be represented sequentially and clearly.  Also it allows for 
easier streamming.  

For the 'add' command, I don't think we make things much easier/clearer by 
adding args.  

I agree a more RESTfull API is a good thing, but I think that is a separate 
task.  For that, we should look at supporting HTTP GET/PUT/DELETE as the main 
control structures rather then passing params.

For the XmlUpdateRequestHandler we added some arguments to the query string so 
that we could call "commit" in the same request that we send documents.  In 
retrospect I'm not sure that was a good idea.  We could achieve the same thing 
with:
{code:xml}
<commands>
  <add>
     ...
  </add>
  <commit />
</commands>
{code}
(this is currently supported by the XmlUpdateRequestHandler, since it only 
starts parsing after it hits known commands (add, commit, etc)



> JSON update handler
> -------------------
>
>                 Key: SOLR-945
>                 URL: https://issues.apache.org/jira/browse/SOLR-945
>             Project: Solr
>          Issue Type: New Feature
>            Reporter: Ryan McKinley
>         Attachments: SOLR-945-json-update.patch
>
>
> In addition to supporting xml and csv updating, it would be good to support 
> json.
> This patch uses [noggit|http://svn.apache.org/repos/asf/labs/noggit/], a 
> streaming json parser, to build the commands.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to