This is an automated email from the ASF dual-hosted git repository.

snagel pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nutch.git


The following commit(s) were added to refs/heads/master by this push:
     new 2408256  NUTCH-2731 Fix to ensure that credentials are set on delete 
operations.
     new dda4578  Merge pull request #464 from deanpearce/bug/solr-cleanup
2408256 is described below

commit 2408256784d1acc510a75f28b34c09204dc58928
Author: Dean Pearce <[email protected]>
AuthorDate: Thu Aug 22 13:38:49 2019 -0400

    NUTCH-2731 Fix to ensure that credentials are set on delete operations.
---
 .../org/apache/nutch/indexwriter/solr/SolrIndexWriter.java   | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git 
a/src/plugin/indexer-solr/src/java/org/apache/nutch/indexwriter/solr/SolrIndexWriter.java
 
b/src/plugin/indexer-solr/src/java/org/apache/nutch/indexwriter/solr/SolrIndexWriter.java
index cc2e8d7..86ca3eb 100644
--- 
a/src/plugin/indexer-solr/src/java/org/apache/nutch/indexwriter/solr/SolrIndexWriter.java
+++ 
b/src/plugin/indexer-solr/src/java/org/apache/nutch/indexwriter/solr/SolrIndexWriter.java
@@ -257,9 +257,19 @@ public class SolrIndexWriter implements IndexWriter {
         LOG.info(
             "SolrIndexer: deleting " + Integer.toString(deleteIds.size()) + "/"
                 + Integer.toString(totalDeletes) + " documents");
+        
+        UpdateRequest req = new UpdateRequest();
+        req.deleteById(deleteIds);
+        req.setAction(UpdateRequest.ACTION.OPTIMIZE, false, false);
+        req.setParams(params);
+        if (this.auth) {
+          req.setBasicAuthCredentials(this.username, this.password);
+        }
+        
         for (SolrClient solrClient : solrClients) {
-          solrClient.deleteById(deleteIds);
+          solrClient.request(req);
         }
+        
       } catch (final SolrServerException e) {
         LOG.error("Error deleting: " + deleteIds);
         throw makeIOException(e);

Reply via email to