lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Solr Wiki] Update of "UpdateJSON" by YonikSeeley
Date Wed, 29 Jun 2011 19:07:57 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.

The "UpdateJSON" page has been changed by YonikSeeley:
http://wiki.apache.org/solr/UpdateJSON?action=diff&rev1=4&rev2=5

Comment:
use array-of-object style in examples

  {{{
  URL=http://localhost:8983/solr/update/json
  curl $URL -H 'Content-type:application/json' -d '
+ [
+   {
- {
-  "add": {
-   "doc": {
      "id" : "MyTestDocument",
      "title" : "This is just a test"
    }
+ ]'
-  }
- }'
  curl "$URL?commit=true"
  }}}
  
  Here's a simple example of adding more than one document at once:
  {{{
  curl http://localhost:8983/solr/update/json -H 'Content-type:application/json' -d '
- {
+ [
-  "add": {"doc": {"id" : "TestDoc1", "title" : "test1"} },
+  {"id" : "TestDoc1", "title" : "test1"},
-  "add": {"doc": {"id" : "TestDoc2", "title" : "another test"} }
+  {"id" : "TestDoc2", "title" : "another test"}
- }'
+ ]'
  }}}
  
  == Update Commands ==
@@ -121, +119 @@

  
  Just as in the other update handlers, parameters such as commit, commitWithin, optimize,
and overwrite may be specified in the URL instead of in the body of the message.
  
+ == Solr 3.1 Example ==
+ Solr 3.2 was the first version to support the array-of-JSONObject syntax, so in Solr 3.1
one needs to use duplicate names (the "add" tag)
+ to add more than one document at once.  This is valid JSON.  Example:
+ {{{
+ curl http://localhost:8983/solr/update/json -H 'Content-type:application/json' -d '
+ {
+  "add": {"doc": {"id" : "TestDoc1", "title" : "test1"} },
+  "add": {"doc": {"id" : "TestDoc2", "title" : "another test"} }
+ }'
+ }}}
+ 

Mime
View raw message