From f2e36fbd0620da14747fe545c1d6219da00feeba Mon Sep 17 00:00:00 2001 From: Michael Peter Christen Date: Mon, 13 May 2013 13:26:24 +0200 Subject: [PATCH] enhanced deletion process for very large number of documents --- .../connector/ConcurrentUpdateSolrConnector.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/source/net/yacy/cora/federate/solr/connector/ConcurrentUpdateSolrConnector.java b/source/net/yacy/cora/federate/solr/connector/ConcurrentUpdateSolrConnector.java index 18dd7cbf1..a6fa9f052 100644 --- a/source/net/yacy/cora/federate/solr/connector/ConcurrentUpdateSolrConnector.java +++ b/source/net/yacy/cora/federate/solr/connector/ConcurrentUpdateSolrConnector.java @@ -291,15 +291,16 @@ public class ConcurrentUpdateSolrConnector implements SolrConnector { } @Override - public void deleteByQuery(String querystring) throws IOException { - final BlockingQueue idq = this.connector.concurrentIDsByQuery(querystring,0, 100000000, Long.MAX_VALUE); + public void deleteByQuery(final String querystring) throws IOException { new Thread() { public void run() { - String id; + ConcurrentUpdateSolrConnector.this.idCache.clear(); try { - while ((id = idq.take()) != AbstractSolrConnector.POISON_ID) ConcurrentUpdateSolrConnector.this.deleteQueue.put(id); - } catch (InterruptedException e) {} - // if we are finished we do a soft commit since that is what an operator wants to see in the gui + ConcurrentUpdateSolrConnector.this.connector.deleteByQuery(querystring); + ConcurrentUpdateSolrConnector.this.idCache.clear(); + } catch (IOException e) { + Log.logSevere("ConcurrentUpdateSolrConnector", e.getMessage(), e); + } ConcurrentUpdateSolrConnector.this.connector.commit(true); } }.start();