Apache Nutch is an extensible and scalable web crawler
NUTCH-1248 Generator to select on status
Markus Jelsmad9ba9e916ed0
diff --git a/CHANGES.txt b/CHANGES.txtindex 175b4f400..da0174655 100644--- a/CHANGES.txt+++ b/CHANGES.txt@@ -1,5 +1,7 @@Nutch Change Log+* NUTCH-1248 Generator to select on status (markus)+* NUTCH-1177 Generator to select on retry interval (markus)* NUTCH-1246 Upgrade to Hadoop 1.0.0 (jnioche)diff --git a/src/java/org/apache/nutch/crawl/Generator.java b/src/java/org/apache/nutch/crawl/Generator.javaindex 735a16b17..4528b65d5 100644--- a/src/java/org/apache/nutch/crawl/Generator.java+++ b/src/java/org/apache/nutch/crawl/Generator.java@@ -62,6 +62,7 @@ public class Generator extends Configured implements Tool {public static final String GENERATE_UPDATE_CRAWLDB = "generate.update.crawldb";public static final String GENERATOR_MIN_SCORE = "generate.min.score";public static final String GENERATOR_MIN_INTERVAL = "generate.min.interval";+ public static final String GENERATOR_RESTRICT_STATUS = "generate.restrict.status";public static final String GENERATOR_FILTER = "generate.filter";public static final String GENERATOR_NORMALISE = "generate.normalise";public static final String GENERATOR_MAX_COUNT = "generate.max.count";@@ -131,6 +132,7 @@ public class Generator extends Configured implements Tool {private FetchSchedule schedule;private float scoreThreshold = 0f;private int intervalThreshold = -1;+ private String restrictStatus = null;private int maxNumSegments = 1;int currentsegmentnum = 1;@@ -158,6 +160,7 @@ public class Generator extends Configured implements Tool {schedule = FetchScheduleFactory.getFetchSchedule(job);scoreThreshold = job.getFloat(GENERATOR_MIN_SCORE, Float.NaN);intervalThreshold = job.getInt(GENERATOR_MIN_INTERVAL, -1);+ restrictStatus = job.get(GENERATOR_RESTRICT_STATUS, null);maxNumSegments = job.getInt(GENERATOR_MAX_NUM_SEGMENTS, 1);segCounts = new int[maxNumSegments];}@@ -205,6 +208,9 @@ public class Generator extends Configured implements Tool {}}+ if (restrictStatus != null+ && !restrictStatus.equalsIgnoreCase(CrawlDatum.getStatusName(crawlDatum.getStatus()))) return;+// consider only entries with a score superior to the thresholdif (scoreThreshold != Float.NaN && sort < scoreThreshold) return;