Skip to content

armgit / nutch

Public Imported from GitHub
0

Apache Nutch is an extensible and scalable web crawler

NUTCH-1857 readb -dump -format csv should use comma

Lewis John McGibbneyfecc0c4286c6
diff --git a/CHANGES.txt b/CHANGES.txt
index b598c1910..4d45bf862 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,6 +1,8 @@
Nutch Change Log
-Nutch Current Development
+Nutch Current Development 1.10-SNAPSHOT
+
+* NUTCH-1857 readb -dump -format csv should use comma (lewismc)
* NUTCH-1853 Add commented out WebGraph executions to ./bin/crawl (lewismc)
diff --git a/src/java/org/apache/nutch/crawl/CrawlDbReader.java b/src/java/org/apache/nutch/crawl/CrawlDbReader.java
index 275356b9b..f97576bd5 100644
--- a/src/java/org/apache/nutch/crawl/CrawlDbReader.java
+++ b/src/java/org/apache/nutch/crawl/CrawlDbReader.java
@@ -30,10 +30,10 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.TreeMap;
+
// Commons Logging imports
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
@@ -100,7 +100,7 @@ public class CrawlDbReader implements Closeable {
public LineRecordWriter(DataOutputStream out) {
this.out = out;
try {
- out.writeBytes("Url;Status code;Status name;Fetch Time;Modified Time;Retries since fetch;Retry interval seconds;Retry interval days;Score;Signature;Metadata\n");
+ out.writeBytes("Url,Status code,Status name,Fetch Time,Modified Time,Retries since fetch,Retry interval seconds,Retry interval days,Score,Signature,Metadata\n");
} catch (IOException e) {}
}
@@ -108,29 +108,29 @@ public class CrawlDbReader implements Closeable {
out.writeByte('"');
out.writeBytes(key.toString());
out.writeByte('"');
- out.writeByte(';');
+ out.writeByte(',');
out.writeBytes(Integer.toString(value.getStatus()));
- out.writeByte(';');
+ out.writeByte(',');
out.writeByte('"');
out.writeBytes(CrawlDatum.getStatusName(value.getStatus()));
out.writeByte('"');
- out.writeByte(';');
+ out.writeByte(',');
out.writeBytes(new Date(value.getFetchTime()).toString());
- out.writeByte(';');
+ out.writeByte(',');
out.writeBytes(new Date(value.getModifiedTime()).toString());
- out.writeByte(';');
+ out.writeByte(',');
out.writeBytes(Integer.toString(value.getRetriesSinceFetch()));
- out.writeByte(';');
+ out.writeByte(',');
out.writeBytes(Float.toString(value.getFetchInterval()));
- out.writeByte(';');
+ out.writeByte(',');
out.writeBytes(Float.toString((value.getFetchInterval() / FetchSchedule.SECONDS_PER_DAY)));
- out.writeByte(';');
+ out.writeByte(',');
out.writeBytes(Float.toString(value.getScore()));
- out.writeByte(';');
+ out.writeByte(',');
out.writeByte('"');
out.writeBytes(value.getSignature() != null ? StringUtil.toHexString(value.getSignature()): "null");
out.writeByte('"');
- out.writeByte(';');
+ out.writeByte(',');
out.writeByte('"');
if (value.getMetaData() != null) {
for (Entry<Writable, Writable> e : value.getMetaData().entrySet()) {
@@ -540,6 +540,7 @@ public class CrawlDbReader implements Closeable {
}
public static void main(String[] args) throws IOException {
+ @SuppressWarnings("resource")
CrawlDbReader dbr = new CrawlDbReader();
if (args.length < 2) {