From 1c4c1c034564efe44ba79d37b609bef4d887f70f Mon Sep 17 00:00:00 2001 From: Michael Peter Christen Date: Thu, 30 May 2013 12:38:54 +0200 Subject: [PATCH] try to commit in case of failure which hopefully frees up some RAM --- .../federate/solr/connector/SolrServerConnector.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/source/net/yacy/cora/federate/solr/connector/SolrServerConnector.java b/source/net/yacy/cora/federate/solr/connector/SolrServerConnector.java index fbfa7497c..880fe58f2 100644 --- a/source/net/yacy/cora/federate/solr/connector/SolrServerConnector.java +++ b/source/net/yacy/cora/federate/solr/connector/SolrServerConnector.java @@ -172,7 +172,7 @@ public abstract class SolrServerConnector extends AbstractSolrConnector implemen if (this.server == null) return; try { if (solrdoc.containsKey("_version_")) solrdoc.setField("_version_",0L); // prevent Solr "version conflict" - this.server.add(solrdoc, -1); + this.server.add(solrdoc, -1); } catch (Throwable e) { // catches "version conflict for": try this again and delete the document in advance try { @@ -181,7 +181,12 @@ public abstract class SolrServerConnector extends AbstractSolrConnector implemen try { this.server.add(solrdoc, -1); } catch (Throwable ee) { - throw new IOException(ee); + try { + this.server.commit(); + this.server.add(solrdoc, -1); + } catch (Throwable eee) { + throw new IOException(eee); + } } } }