Skip to content

armgit / nutch

Public Imported from GitHub
0

Apache Nutch is an extensible and scalable web crawler

NUTCH-640 - confusing description "set it to Integer.MAX_VALUE"

Tacettin Guneyefb617d66b59
diff --git a/CHANGES.txt b/CHANGES.txt
index 1619a5fd7..f28ba36f6 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -281,6 +281,9 @@ Unreleased changes (1.0-dev)
103. NUTCH-654 - urlfilter-regex's main does not work.
(dogacan)
+104. NUTCH-640 - confusing description "set it to Integer.MAX_VALUE".
+ (dogacan)
+
Release 0.9 - 2007-04-02
1. Changed log4j confiquration to log to stdout on commandline
diff --git a/conf/nutch-default.xml b/conf/nutch-default.xml
index f4b0a7ca7..71bbaa42c 100644
--- a/conf/nutch-default.xml
+++ b/conf/nutch-default.xml
@@ -634,8 +634,8 @@
from the index tokens that occur further in the document. If you
know your source documents are large, be sure to set this value
high enough to accomodate the expected size. If you set it to
- Integer.MAX_VALUE, then the only limit is your memory, but you
- should anticipate an OutOfMemoryError.
+ -1, then the only limit is your memory, but you should anticipate
+ an OutOfMemoryError.
</description>
</property>
diff --git a/src/java/org/apache/nutch/indexer/Indexer.java b/src/java/org/apache/nutch/indexer/Indexer.java
index a723da2e8..dc95dc171 100644
--- a/src/java/org/apache/nutch/indexer/Indexer.java
+++ b/src/java/org/apache/nutch/indexer/Indexer.java
@@ -90,6 +90,9 @@ public class Indexer extends Configured implements Tool, Reducer<Text, NutchWrit
final Path temp =
job.getLocalPath("index/_"+Integer.toString(new Random().nextInt()));
+ int maxTokens = job.getInt("indexer.max.tokens", 10000);
+ if (maxTokens < 0) maxTokens = Integer.MAX_VALUE;
+
fs.delete(perm, true); // delete old, if any
final AnalyzerFactory factory = new AnalyzerFactory(job);
@@ -102,7 +105,7 @@ public class Indexer extends Configured implements Tool, Reducer<Text, NutchWrit
writer.setMaxMergeDocs(job.getInt("indexer.maxMergeDocs", Integer.MAX_VALUE));
writer.setTermIndexInterval
(job.getInt("indexer.termIndexInterval", 128));
- writer.setMaxFieldLength(job.getInt("indexer.max.tokens", 10000));
+ writer.setMaxFieldLength(maxTokens);
writer.setInfoStream(LogUtil.getInfoStream(LOG));
writer.setUseCompoundFile(false);
writer.setSimilarity(new NutchSimilarity());