Skip to content

armgit / nutch

Public Imported from GitHub
0

Apache Nutch is an extensible and scalable web crawler

NUTCH-2115 - Add total counts to mimetype stats this closes #65

Lewis John McGibbney2885f6cfad56
diff --git a/CHANGES.txt b/CHANGES.txt
index e866c6a5f..92787eb13 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -2,6 +2,8 @@ Nutch Change Log
Nutch Current Development 1.11-SNAPSHOT
+* NUTCH-2115 - Add total counts to mimetype stats (Jimmy Joyce via lewismc)
+
* NUTCH-2111 Delete temporary files location for selenium tmp files after driver quits (Kim Whitehall via lewismc)
* NUTCH-2095 WARC exporter for the CommonCrawlDataDumper (jorgelbg)
diff --git a/src/java/org/apache/nutch/util/DumpFileUtil.java b/src/java/org/apache/nutch/util/DumpFileUtil.java
index 12593ced3..786f75fca 100644
--- a/src/java/org/apache/nutch/util/DumpFileUtil.java
+++ b/src/java/org/apache/nutch/util/DumpFileUtil.java
@@ -111,15 +111,19 @@ public class DumpFileUtil {
// print total stats
builder.append("\nTOTAL Stats:\n");
builder.append("[\n");
+ int mimetypeCount = 0;
for (String mimeType : typeCounts.keySet()) {
builder.append(" {\"mimeType\":\"");
builder.append(mimeType);
builder.append("\",\"count\":\"");
builder.append(typeCounts.get(mimeType));
builder.append("\"}\n");
+ mimetypeCount += typeCounts.get(mimeType);
}
builder.append("]\n");
+ builder.append("Total count: " + mimetypeCount + "\n");
// filtered types stats
+ mimetypeCount = 0;
if (!filteredCounts.isEmpty()) {
builder.append("\nFILTERED Stats:\n");
builder.append("[\n");
@@ -129,8 +133,10 @@ public class DumpFileUtil {
builder.append("\",\"count\":\"");
builder.append(filteredCounts.get(mimeType));
builder.append("\"}\n");
+ mimetypeCount += filteredCounts.get(mimeType);
}
builder.append("]\n");
+ builder.append("Total filtered count: " + mimetypeCount + "\n");
}
return builder.toString();
}