Skip to content

armgit / nutch

Public Imported from GitHub
0

Apache Nutch is an extensible and scalable web crawler

NUTCH-1758 IndexChecker to send document to IndexWriters (jnioche)

Julien Niocheadd21c0634f9
diff --git a/CHANGES.txt b/CHANGES.txt
index 988c6f1bf..c9826d8ee 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -2,6 +2,8 @@ Nutch Change Log
Nutch Current Development
+* NUTCH-1758 IndexChecker to send document to IndexWriters (jnioche)
+
* NUTCH-1786 CrawlDb should follow db.url.normalizers and db.url.filters (Diaa via markus)
* NUTCH-1757 ParserChecker to take custom metadata as input (jnioche)
diff --git a/src/java/org/apache/nutch/indexer/IndexingFiltersChecker.java b/src/java/org/apache/nutch/indexer/IndexingFiltersChecker.java
index 9d3cfef3b..d46f38ac6 100644
--- a/src/java/org/apache/nutch/indexer/IndexingFiltersChecker.java
+++ b/src/java/org/apache/nutch/indexer/IndexingFiltersChecker.java
@@ -22,6 +22,7 @@ import java.util.List;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.conf.Configured;
import org.apache.hadoop.io.Text;
+import org.apache.hadoop.mapred.JobConf;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;
import org.apache.nutch.crawl.CrawlDatum;
@@ -84,6 +85,8 @@ public class IndexingFiltersChecker extends Configured implements Tool {
ProtocolOutput output = protocol.getProtocolOutput(new Text(url), datum);
+ IndexWriters writers = new IndexWriters(getConf());
+
if (!output.getStatus().isSuccess()) {
System.out.println("Fetch failed with protocol status: " + output.getStatus());
return 0;
@@ -150,6 +153,13 @@ public class IndexingFiltersChecker extends Configured implements Tool {
}
}
}
+
+ if (conf.getBoolean("doIndex", false) && doc!=null){
+ writers.open(new JobConf(getConf()), "IndexingFilterChecker");
+ writers.write(doc);
+ writers.close();
+ }
+
return 0;
}