You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by Apache Wiki <wi...@apache.org> on 2016/03/25 20:01:15 UTC

[Solr Wiki] Update of "UpdateXmlMessages" by ShawnHeisey

Dear Wiki user,

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

The "UpdateXmlMessages" page has been changed by ShawnHeisey:
https://wiki.apache.org/solr/UpdateXmlMessages?action=diff&rev1=47&rev2=48

Comment:
Change subversion link to a git link.

  = XML Messages for Updating a Solr Index =
  
- Solr accepts POSTed XML messages that Add/Replace, Commit, Delete, and Delete by query, using the url '''/update''' (there is also a [[UpdateCSV|CSV]] interface).  Here is the XML syntax that Solr expects to see: 
+ Solr accepts POSTed XML messages that Add/Replace, Commit, Delete, and Delete by query, using the url '''/update''' (there is also a [[UpdateCSV|CSV]] interface).  Here is the XML syntax that Solr expects to see:
  
  <<TableOfContents>>
  
  == The Update Schema ==
  
- (Not to be confused with [[SchemaXml|schema.xml]].) 
+ (Not to be confused with [[SchemaXml|schema.xml]].)
  
  === add/replace documents ===
  
@@ -26, +26 @@

  </add>
  }}}
  
- Subversion contains many [[http://svn.apache.org/repos/asf/lucene/dev/trunk/solr/example/exampledocs/|complex examples of <add> document messages]].
+ Git contains many [[https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;a=tree;f=solr/example/exampledocs|complex examples of <add> document messages]].
  
  Note: multiple documents may be specified in a single `<add>` command.
  
@@ -35, +35 @@

     * `commitWithin = "(milliseconds)"` if the "commitWithin" attribute is present, the document will be added within that time. <!> [[Solr1.4]]. See CommitWithin
  
     * (removed in [[Solr4.0]] - use "overwrite") `allowDups = "true" | "false"` &#8212; default is "false"
-    * (removed in [[Solr4.0]] - use "overwrite") `overwritePending = "true" | "false"` &#8212; default is negation of allowDups 
+    * (removed in [[Solr4.0]] - use "overwrite") `overwritePending = "true" | "false"` &#8212; default is negation of allowDups
-    * (removed in [[Solr4.0]] - use "overwrite") `overwriteCommitted = "true"|"false"` &#8212; default is negation of allowDups 
+    * (removed in [[Solr4.0]] - use "overwrite") `overwriteCommitted = "true"|"false"` &#8212; default is negation of allowDups
  
  ==== Optional attributes on "doc" ====
-    * `boost = <float>`  &#8212; default is 1.0 
+    * `boost = <float>`  &#8212; default is 1.0
       * This is a convinience mechanism equivilent to specifying a `boost` attribute on each of the individual fields that support norms (see below)
-  
+ 
  ==== Optional attributes for "field" ====
     * `update = "add" | "set" | "inc"` &#8212; for [[Atomic_Updates|atomic updating and adding of fields]] <!> [[Solr4.0]]
     * `boost = <float>` &#8212; default is 1.0 (See [[SolrRelevancyFAQ#index-time_boosts|SolrRelevancyFAQ]])
@@ -109, +109 @@

  <commit/>
  <optimize/>
  }}}
-  
+ 
  ==== Optional attributes for "commit" and "optimize" ====
  
     * `waitFlush = "true" | "false"`  &#8212; default is true   &#8212;  block until index changes are flushed to disk <!> [[Solr1.4]] At least in Solr 1.4 and later (perhaps earlier as well), this command has no affect. In <!> [[Solr4.0]] it will be removed.
@@ -144, +144 @@

  curl 'http://localhost:8983/solr/update?optimize=true&maxSegments=10&waitFlush=false'
  }}}
  
- <!> [[Solr3.4]] 
+ <!> [[Solr3.4]]
  This example adds a small test document with a CommitWithin instruction which tells Solr to make sure the document is committed no later than 10 seconds later (this method is generally preferred over explicit commits):
  {{{
  curl http://localhost:8983/solr/update?commitWithin=10000 -H "Content-Type: text/xml" --data-binary '<add><doc><field name="id">testdoc</field></doc></add>'
@@ -163, +163 @@

  <delete><query>office:Bridgewater</query></delete>
  }}}
  
- Note: The "delete by query" uses the Lucene query parser by default, so if you're trying to understand the results of delete by query, you might submit a URL like this: 
+ Note: The "delete by query" uses the Lucene query parser by default, so if you're trying to understand the results of delete by query, you might submit a URL like this:
     {{{
  ?q=stuff nonsense&debugQuery=on
  
@@ -188, +188 @@

  
  ==== Optional attributes for "delete" ====
  
-    * (deprecated) `fromPending = "true" | "false"`  &#8212; default is "true" 
+    * (deprecated) `fromPending = "true" | "false"`  &#8212; default is "true"
     * (deprecated) `fromCommitted = "true" | "false"`  &#8212; default is "true"
  
  === "rollback" ===
@@ -198, +198 @@

     {{{
  <rollback/>
  }}}
-  
+ 
  The rollback command rollbacks all add/deletes made to the index since the last commit. It neither calls any event listeners nor creates a new searcher.
  This is an expert-level API that should only be used if the application is taking complete responsibility for update concurrency, replication, and sharding.
  
@@ -234, +234 @@

  
  {{{
  (delete specific doc)
- http://localhost:8983/solr/update?stream.body=%3Cdelete%3E%3Cquery%3Eoffice:Bridgewater%3C/query%3E%3C/delete%3E 
+ http://localhost:8983/solr/update?stream.body=%3Cdelete%3E%3Cquery%3Eoffice:Bridgewater%3C/query%3E%3C/delete%3E
  
  (delete all docs)
- http://localhost:8983/solr/update?stream.body=%3Cdelete%3E%3Cquery%3E*:*%3C/query%3E%3C/delete%3E  
+ http://localhost:8983/solr/update?stream.body=%3Cdelete%3E%3Cquery%3E*:*%3C/query%3E%3C/delete%3E
  
  (commit)
  http://localhost:8983/solr/update?stream.body=%3Ccommit/%3E
@@ -246, +246 @@

  === Add and delete in a single batch ===
  Mixing add and delete elements in a single batch will throw an ''Illegal to have multiple roots (start tag in epilog?)'' exception ([[https://issues.apache.org/jira/browse/SOLR-2277|SOLR-2277]]):
  {{{
- curl http://127.0.0.1:8983/solr/update/?commit=true -H "Content-Type: text/xml" --data-binary '<add><doc><field name="id">17</field></doc></add><delete><id>1234</id></delete>'; 
+ curl http://127.0.0.1:8983/solr/update/?commit=true -H "Content-Type: text/xml" --data-binary '<add><doc><field name="id">17</field></doc></add><delete><id>1234</id></delete>';
  }}}
  
  Instead, the add and delete elements must be enclosed in within an update element: