From ff656ce860bb0baa4a82a6300dbbad21a36301d9 Mon Sep 17 00:00:00 2001 From: Michael Peter Christen Date: Wed, 12 Feb 2014 01:01:23 +0100 Subject: [PATCH] explicit call to optimize to add a expungeDeleted flag --- .../cora/federate/solr/connector/SolrServerConnector.java | 5 +++-- 1 file changed, 3 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 463b96e3e..7582a2f27 100644 --- a/source/net/yacy/cora/federate/solr/connector/SolrServerConnector.java +++ b/source/net/yacy/cora/federate/solr/connector/SolrServerConnector.java @@ -42,6 +42,7 @@ import org.apache.solr.client.solrj.SolrServer; import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.request.ContentStreamUpdateRequest; import org.apache.solr.client.solrj.request.LukeRequest; +import org.apache.solr.client.solrj.request.UpdateRequest; import org.apache.solr.client.solrj.response.LukeResponse.FieldInfo; import org.apache.solr.client.solrj.response.LukeResponse; import org.apache.solr.client.solrj.response.QueryResponse; @@ -75,7 +76,6 @@ public abstract class SolrServerConnector extends AbstractSolrConnector implemen synchronized (this.server) { try { this.server.commit(true, true, softCommit); - //if (this.server instanceof HttpSolrServer) ((HttpSolrServer) this.server).shutdown(); } catch (final Throwable e) { clearCaches(); // prevent further OOM if this was caused by OOM //Log.logException(e); @@ -92,7 +92,8 @@ public abstract class SolrServerConnector extends AbstractSolrConnector implemen if (getSegmentCount() <= maxSegments) return; synchronized (this.server) { try { - this.server.optimize(true, true, maxSegments); + //this.server.optimize(true, true, maxSegments); + new UpdateRequest().setAction(UpdateRequest.ACTION.OPTIMIZE, true, true, maxSegments, true).process(this.server); // this includes a 'true' for expungeDelete } catch (final Throwable e) { clearCaches(); // prevent further OOM if this was caused by OOM ConcurrentLog.logException(e);