enhanced deletion process for very large number of documents

pull/1/head
Michael Peter Christen 12 years ago
parent 79401cb938
commit f2e36fbd06

@ -291,15 +291,16 @@ public class ConcurrentUpdateSolrConnector implements SolrConnector {
} }
@Override @Override
public void deleteByQuery(String querystring) throws IOException { public void deleteByQuery(final String querystring) throws IOException {
final BlockingQueue<String> idq = this.connector.concurrentIDsByQuery(querystring,0, 100000000, Long.MAX_VALUE);
new Thread() { new Thread() {
public void run() { public void run() {
String id; ConcurrentUpdateSolrConnector.this.idCache.clear();
try { try {
while ((id = idq.take()) != AbstractSolrConnector.POISON_ID) ConcurrentUpdateSolrConnector.this.deleteQueue.put(id); ConcurrentUpdateSolrConnector.this.connector.deleteByQuery(querystring);
} catch (InterruptedException e) {} ConcurrentUpdateSolrConnector.this.idCache.clear();
// if we are finished we do a soft commit since that is what an operator wants to see in the gui } catch (IOException e) {
Log.logSevere("ConcurrentUpdateSolrConnector", e.getMessage(), e);
}
ConcurrentUpdateSolrConnector.this.connector.commit(true); ConcurrentUpdateSolrConnector.this.connector.commit(true);
} }
}.start(); }.start();

Loading…
Cancel
Save