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] Trivial Update of "Per Steffensen/Update semantics" by Per Steffensen
Date Tue, 17 Apr 2012 15:09:18 GMT
Dear Wiki user,

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

The "Per Steffensen/Update semantics" page has been changed by Per Steffensen:
http://wiki.apache.org/solr/Per%20Steffensen/Update%20semantics?action=diff&rev1=11&rev2=12

  {{{#!java
  SolrServer server = ... somehow you have a server ...
  
- UpdateResponse response = server.add(docs, ... your SolrParams ...);
+ UpdateResponse response = server.add(docs, ... your SolrParams ...).get();
  }}}
  
  ==== Catching errors ====
@@ -131, +131 @@

  {{{#!java
  UpdateResponse response;
  try {
-     response = server.add(docs, ... your SolrParams ...);
+     response = server.add(docs, ... your SolrParams ...).get();
  } catch (PartialErrors e) {
      response = (UpdateResponse)e.getSpecializedResponse();
      DocumentUpdatePartialError err;
@@ -152, +152 @@

  If you only send one document in your request there is no reason to deal with PartialErrors,
so for convenience catching per-document errors is possible like this
  {{{#!java
  try {
-     UpdateResponse response = server.add(... one doc ..., ... your SolrParams ...);
+     UpdateResponse response = server.add(... one doc ..., ... your SolrParams ...).get();
  } catch (DocumentDoesNotExist e) {
      ... do something ...
  } catch (DocumentAlreadyExists e) {

Mime
View raw message