You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by Apache Wiki <wi...@apache.org> on 2012/04/17 17:09:18 UTC
[Solr Wiki] Trivial Update of "Per Steffensen/Update semantics" by Per Steffensen
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) {