From 1de21edefee0dd7da53c487cede8d1e112b9b810 Mon Sep 17 00:00:00 2001 From: Yonik Seeley Date: Fri, 30 May 2008 16:10:09 +0000 Subject: [PATCH] SOLR-587: use Lucene's deleteByQuery git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@661778 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/solr/update/DirectUpdateHandler2.java | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/java/org/apache/solr/update/DirectUpdateHandler2.java b/src/java/org/apache/solr/update/DirectUpdateHandler2.java index c34701351a2..6ff321240df 100644 --- a/src/java/org/apache/solr/update/DirectUpdateHandler2.java +++ b/src/java/org/apache/solr/update/DirectUpdateHandler2.java @@ -310,14 +310,9 @@ public class DirectUpdateHandler2 extends UpdateHandler { if (delAll) { deleteAll(); } else { - closeWriter(); - openSearcher(); - - // if we want to count the number of docs that were deleted, then - // we need a new instance of the DeleteHitCollector - final DeleteHitCollector deleter = new DeleteHitCollector(searcher); - searcher.search(q, null, deleter); - totDeleted = deleter.deleted; + closeSearcher(); + openWriter(); + writer.deleteDocuments(q); } } finally { iwCommit.unlock(); @@ -341,7 +336,7 @@ public class DirectUpdateHandler2 extends UpdateHandler { numErrorsCumulative.incrementAndGet(); } } - } + }