Apache Nutch is an extensible and scalable web crawler
NUTCH-2008 IndexerMapReduce to use single instance of NutchIndexAction for deletions
Sebastian Nagel7fa9cef2d6ba
diff --git a/CHANGES.txt b/CHANGES.txtindex edc00a857..a4c4b0ea2 100644--- a/CHANGES.txt+++ b/CHANGES.txt@@ -2,6 +2,8 @@ Nutch Change LogNutch Current Development 1.11-SNAPSHOT+* NUTCH-2008 IndexerMapReduce to use single instance of NutchIndexAction for deletions (snagel)+* NUTCH-1998 Add support for user-defined file extension to CommonCrawlDataDumper (totaro via mattmann)* NUTCH-1873 Solr IndexWriter/Job to report number of docs indexed. (snagel via lewismc)diff --git a/src/java/org/apache/nutch/indexer/IndexerMapReduce.java b/src/java/org/apache/nutch/indexer/IndexerMapReduce.javaindex 73fb6aa78..debaed3b5 100644--- a/src/java/org/apache/nutch/indexer/IndexerMapReduce.java+++ b/src/java/org/apache/nutch/indexer/IndexerMapReduce.java@@ -77,6 +77,10 @@ public class IndexerMapReduce extends Configured implementsprivate URLNormalizers urlNormalizers;private URLFilters urlFilters;+ /** Predefined action to delete documents from the index */+ private static final NutchIndexAction DELETE_ACTION = new NutchIndexAction(+ null, NutchIndexAction.DELETE);+public void configure(JobConf job) {setConf(job);this.filters = new IndexingFilters(getConf());@@ -206,9 +210,7 @@ public class IndexerMapReduce extends Configured implementsif (robotsMeta != null&& robotsMeta.toLowerCase().indexOf("noindex") != -1) {// Delete it!- NutchIndexAction action = new NutchIndexAction(null,- NutchIndexAction.DELETE);- output.collect(key, action);+ output.collect(key, DELETE_ACTION);reporter.incrCounter("IndexerStatus", "deleted (robots=noindex)", 1);return;}@@ -225,10 +227,7 @@ public class IndexerMapReduce extends Configured implementsif (fetchDatum.getStatus() == CrawlDatum.STATUS_FETCH_GONE|| dbDatum.getStatus() == CrawlDatum.STATUS_DB_GONE) {reporter.incrCounter("IndexerStatus", "deleted (gone)", 1);-- NutchIndexAction action = new NutchIndexAction(null,- NutchIndexAction.DELETE);- output.collect(key, action);+ output.collect(key, DELETE_ACTION);return;}@@ -237,10 +236,7 @@ public class IndexerMapReduce extends Configured implements|| dbDatum.getStatus() == CrawlDatum.STATUS_DB_REDIR_PERM|| dbDatum.getStatus() == CrawlDatum.STATUS_DB_REDIR_TEMP) {reporter.incrCounter("IndexerStatus", "deleted redirects", 1);-- NutchIndexAction action = new NutchIndexAction(null,- NutchIndexAction.DELETE);- output.collect(key, action);+ output.collect(key, DELETE_ACTION);return;}}@@ -253,9 +249,7 @@ public class IndexerMapReduce extends Configured implements// Whether to delete pages marked as duplicatesif (delete && dbDatum.getStatus() == CrawlDatum.STATUS_DB_DUPLICATE) {reporter.incrCounter("IndexerStatus", "deleted duplicates", 1);- NutchIndexAction action = new NutchIndexAction(null,- NutchIndexAction.DELETE);- output.collect(key, action);+ output.collect(key, DELETE_ACTION);return;}