Skip to content

armgit / nutch

Public Imported from GitHub
0

Apache Nutch is an extensible and scalable web crawler

NUTCH-612 URL filtering was disabled when invoking Generator from Crawl.

Andrzej Bialecki01c312efc33d
diff --git a/CHANGES.txt b/CHANGES.txt
index 7ecccc2a0..5e71ac3b0 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -220,6 +220,9 @@ Unreleased changes (1.0-dev)
79. NUTCH-613 - Empty summaries and cached pages (kubes via ab)
+80. NUTCH-612 - URL filtering was disabled in Generator when invoked
+ from Crawl (Susam Pal via ab)
+
Release 0.9 - 2007-04-02
diff --git a/src/java/org/apache/nutch/crawl/Crawl.java b/src/java/org/apache/nutch/crawl/Crawl.java
index 6022d3534..06eacd0a1 100644
--- a/src/java/org/apache/nutch/crawl/Crawl.java
+++ b/src/java/org/apache/nutch/crawl/Crawl.java
@@ -117,7 +117,7 @@ public class Crawl {
int i;
for (i = 0; i < depth; i++) { // generate new segment
Path segment = generator.generate(crawlDb, segments, -1, topN, System
- .currentTimeMillis(), false, false);
+ .currentTimeMillis());
if (segment == null) {
LOG.info("Stopping at depth=" + i + " - no more URLs to fetch.");
break;
diff --git a/src/java/org/apache/nutch/crawl/Generator.java b/src/java/org/apache/nutch/crawl/Generator.java
index 5a161c381..f64e02644 100644
--- a/src/java/org/apache/nutch/crawl/Generator.java
+++ b/src/java/org/apache/nutch/crawl/Generator.java
@@ -371,11 +371,28 @@ public class Generator extends ToolBase {
setConf(conf);
}
- /** Generate fetchlists in a segment. */
- public Path generate(Path dbDir, Path segments)
- throws IOException {
- return generate(dbDir, segments, -1, Long.MAX_VALUE, System
- .currentTimeMillis(), true, false);
+ /**
+ * Generate fetchlists in a segment. Whether to filter URLs or not is
+ * read from the crawl.generate.filter property in the configuration
+ * files. If the property is not found, the URLs are filtered.
+ *
+ * @param dbDir Crawl database directory
+ * @param segments Segments directory
+ * @param numLists Number of reduce tasks
+ * @param topN Number of top URLs to be selected
+ * @param curTime Current time in milliseconds
+ *
+ * @return Path to generated segment or null if no entries were
+ * selected
+ *
+ * @throws IOException When an I/O error occurs
+ */
+ public Path generate(Path dbDir, Path segments, int numLists,
+ long topN, long curTime) throws IOException {
+
+ JobConf job = new NutchJob(getConf());
+ boolean filter = job.getBoolean(CRAWL_GENERATE_FILTER, true);
+ return generate(dbDir, segments, numLists, topN, curTime, filter, false);
}
/**