Skip to content

armgit / nutch

Public Imported from GitHub
0

Apache Nutch is an extensible and scalable web crawler

NUTCH-1106 Options to skip url's based on length - most browsers support URLs up to around 2048 characters - use this value for the rule in regex-urlfilter.txt - limit outlink length to 4096 characters to allow additional characters removed during normalization (anchor, query args)

Sebastian Nagel8d434b5a43f9
diff --git a/conf/nutch-default.xml b/conf/nutch-default.xml
index d1af10afa..d7ad16f09 100644
--- a/conf/nutch-default.xml
+++ b/conf/nutch-default.xml
@@ -702,7 +702,7 @@
<property>
<name>db.max.outlink.length</name>
- <value>8192</value>
+ <value>4096</value>
<description>
The maximum length in characters accepted for outlinks before
applying URL normalizers and filters. If this value is
diff --git a/conf/regex-urlfilter.txt.template b/conf/regex-urlfilter.txt.template
index ea86cc9b0..4319bf164 100644
--- a/conf/regex-urlfilter.txt.template
+++ b/conf/regex-urlfilter.txt.template
@@ -26,8 +26,8 @@
# skip file: ftp: and mailto: urls
-^(file|ftp|mailto):
-# skip URLs longer than 8192 characters, see also db.max.outlink.length
-#-^.{8193,}
+# skip URLs longer than 2048 characters, see also db.max.outlink.length
+#-^.{2049,}
# skip image and other suffixes we can't yet parse
# for a more extensive coverage use the urlfilter-suffix plugin
diff --git a/src/java/org/apache/nutch/fetcher/FetcherThread.java b/src/java/org/apache/nutch/fetcher/FetcherThread.java
index 2bd4d2280..088b0fdd9 100644
--- a/src/java/org/apache/nutch/fetcher/FetcherThread.java
+++ b/src/java/org/apache/nutch/fetcher/FetcherThread.java
@@ -200,7 +200,7 @@ public class FetcherThread extends Thread {
int maxOutlinksPerPage = conf.getInt("db.max.outlinks.per.page", 100);
maxOutlinks = (maxOutlinksPerPage < 0) ? Integer.MAX_VALUE
: maxOutlinksPerPage;
- int maxOutlinkL = conf.getInt("db.max.outlink.length", 8192);
+ int maxOutlinkL = conf.getInt("db.max.outlink.length", 4096);
maxOutlinkLength = (maxOutlinkL < 0) ? Integer.MAX_VALUE : maxOutlinkL;
interval = conf.getInt("db.fetch.interval.default", 2592000);
ignoreInternalLinks = conf.getBoolean("db.ignore.internal.links", false);
diff --git a/src/java/org/apache/nutch/parse/ParseOutputFormat.java b/src/java/org/apache/nutch/parse/ParseOutputFormat.java
index 1efbbbcdc..82e3c9a86 100644
--- a/src/java/org/apache/nutch/parse/ParseOutputFormat.java
+++ b/src/java/org/apache/nutch/parse/ParseOutputFormat.java
@@ -164,7 +164,7 @@ public class ParseOutputFormat extends OutputFormat<Text, Parse> {
int maxOutlinksPerPage = conf.getInt("db.max.outlinks.per.page", 100);
final int maxOutlinks = (maxOutlinksPerPage < 0) ? Integer.MAX_VALUE
: maxOutlinksPerPage;
- int maxOutlinkL = conf.getInt("db.max.outlink.length", 8192);
+ int maxOutlinkL = conf.getInt("db.max.outlink.length", 4096);
final int maxOutlinkLength = (maxOutlinkL < 0) ? Integer.MAX_VALUE
: maxOutlinkL;
final boolean isParsing = conf.getBoolean("fetcher.parse", true);