Description
Currently, UpdateRequestHandler accepts a sequence of operations in JSON format by specifying duplicate keys. While duplicate keys aren't forbidden by the JSON spec, in practice, this makes the update handler difficult to use in conjunction with JSON serialization libraries in clients.
This has been mitigated somewhat by adding special syntax to add and delete in SOLR-2496 and SOLR-3508 respectively, but there's still no way to specify operations in a particular sequence as you can with XML. Per the JSON spec, the right way to do this is with an array, as objects are considered unordered sets.
Using an array at the top level would obviate the need for such a key, but that syntax was used in the fix for SOLR-2496 as a shortcut for adds, so...
The attached patch adds an "operations" key that can exist at the same level as any other operation. The "operations" key's value is an array of objects, each of which uses the same syntax as the root object:
{ "operations": [ {"add": {"id": "1"}}, {"delete": {"query": "foo"}}, {"add": {"id": "2"}}, {"commit": {}}, ] }