Skip to content

armgit / nutch

Public Imported from GitHub
0

Apache Nutch is an extensible and scalable web crawler

NUTCH-1259 Store detected content type in crawldatum metadata

Julien Niochec24f262e3640
diff --git a/CHANGES.txt b/CHANGES.txt
index 9efa91888..5ab0607e7 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,5 +1,7 @@
Nutch Change Log
+* NUTCH-1259 Store detected content-type in crawldatum metadata (jnioche, markus)
+
* NUTCH-1266 Subcollection to optionally write to configured fields (markus)
* NUTCH-1005 Parse headings plugin (markus)
diff --git a/src/java/org/apache/nutch/fetcher/Fetcher.java b/src/java/org/apache/nutch/fetcher/Fetcher.java
index 5702f9f52..5466df5de 100644
--- a/src/java/org/apache/nutch/fetcher/Fetcher.java
+++ b/src/java/org/apache/nutch/fetcher/Fetcher.java
@@ -924,7 +924,9 @@ public class Fetcher extends Configured implements Tool,
datum.setStatus(status);
datum.setFetchTime(System.currentTimeMillis());
if (pstatus != null) datum.getMetaData().put(Nutch.WRITABLE_PROTO_STATUS_KEY, pstatus);
-
+ // store the guessed content type in the crawldatum
+ if (content.getContentType() != null) datum.getMetaData().put(new Text(Metadata.CONTENT_TYPE), new Text(content.getContentType()));
+
ParseResult parseResult = null;
if (content != null) {
Metadata metadata = content.getMetadata();