Apache Nutch is an extensible and scalable web crawler
NUTCH-1293 IndexingFiltersChecker to store detected content type in crawldatum metadata
Markus Jelsma78ce9a6cc378
diff --git a/CHANGES.txt b/CHANGES.txtindex 5e1aced76..6b44f7d8c 100644--- a/CHANGES.txt+++ b/CHANGES.txt@@ -1,5 +1,7 @@Nutch Change Log+* NUTCH-1293 IndexingFiltersChecker to store detected content type in crawldatum metadata (markus)+* NUTCH-1291 Fetcher to stringify exception on // unexpected exception (markus)* NUTCH-965 Skip parsing for truncated documents (alexis, lewismc, ferdy)diff --git a/src/java/org/apache/nutch/indexer/IndexingFiltersChecker.java b/src/java/org/apache/nutch/indexer/IndexingFiltersChecker.javaindex c9f75f6b9..ce68afaf7 100644--- a/src/java/org/apache/nutch/indexer/IndexingFiltersChecker.java+++ b/src/java/org/apache/nutch/indexer/IndexingFiltersChecker.java@@ -15,6 +15,7 @@ import org.apache.nutch.crawl.Inlinks;import org.apache.nutch.indexer.IndexingException;import org.apache.nutch.indexer.IndexingFilters;import org.apache.nutch.indexer.NutchDocument;+import org.apache.nutch.metadata.Metadata;import org.apache.nutch.parse.Parse;import org.apache.nutch.parse.ParseResult;import org.apache.nutch.parse.ParseUtil;@@ -65,7 +66,10 @@ public class IndexingFiltersChecker extends Configured implements Tool {Content content = protocol.getProtocolOutput(new Text(url), datum).getContent();-++ // store the guessed content type in the crawldatum+ if (content.getContentType() != null) datum.getMetaData().put(new Text(Metadata.CONTENT_TYPE), new Text(content.getContentType()));+if (content == null) {System.out.println("No content for " + url);return 0;@@ -81,7 +85,7 @@ public class IndexingFiltersChecker extends Configured implements Tool {LOG.info("parsing: " + url);LOG.info("contentType: " + contentType);}-+ParseResult parseResult = new ParseUtil(conf).parse(content);NutchDocument doc = new NutchDocument();