Apache Nutch is an extensible and scalable web crawler
NUTCH-1051 Export WebGraph node scores for Solr.ExternalFileField
Markus Jelsma45f8c542ae54
diff --git a/CHANGES.txt b/CHANGES.txtindex 52eed6fac..3e230f321 100644--- a/CHANGES.txt+++ b/CHANGES.txt@@ -2,6 +2,8 @@ Nutch Change LogRelease 1.4 - Current development+* NUTCH-1051 Export WebGraph node scores for Solr.ExternalFileField (markus)+* NUTCH-1083 ParserChecker implements Tools (jnioche)* NUTCH-1082 IndexingFiltersChecker utility does not list multi valued fields (markus)diff --git a/src/java/org/apache/nutch/scoring/webgraph/NodeDumper.java b/src/java/org/apache/nutch/scoring/webgraph/NodeDumper.javaindex 4a6f227f3..7e55e19c1 100644--- a/src/java/org/apache/nutch/scoring/webgraph/NodeDumper.java+++ b/src/java/org/apache/nutch/scoring/webgraph/NodeDumper.java@@ -159,7 +159,7 @@ public class NodeDumper** @throws IOException If an error occurs while dumping the top values.*/- public void dumpNodes(Path webGraphDb, DumpType type, long topN, Path output)+ public void dumpNodes(Path webGraphDb, DumpType type, long topN, Path output, boolean asEff)throws IOException {SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");@@ -186,6 +186,11 @@ public class NodeDumperdumper.setBoolean("scores", type == DumpType.SCORES);dumper.setLong("topn", topN);+ // Set equals-sign as separator for Solr's ExternalFileField+ if (asEff) {+ dumper.set("mapred.textoutputformat.separator", "=");+ }+try {LOG.info("NodeDumper: running");JobClient.runJob(dumper);@@ -226,6 +231,8 @@ public class NodeDumper"show topN scores").create("topn");Option outputOpts = OptionBuilder.withArgName("output").hasArg().withDescription("the output directory to use").create("output");+ Option effOpts = OptionBuilder.withArgName("asEff").withDescription(+ "Solr ExternalFileField compatible output format").create("asEff");options.addOption(helpOpts);options.addOption(webGraphDbOpts);options.addOption(inlinkOpts);@@ -233,6 +240,7 @@ public class NodeDumperoptions.addOption(scoreOpts);options.addOption(topNOpts);options.addOption(outputOpts);+ options.addOption(effOpts);CommandLineParser parser = new GnuParser();try {@@ -256,7 +264,10 @@ public class NodeDumperDumpType type = (inlinks ? DumpType.INLINKS : outlinks? DumpType.OUTLINKS : DumpType.SCORES);- dumpNodes(new Path(webGraphDb), type, topN, new Path(output));+ // Use ExternalFileField?+ boolean asEff = line.hasOption("asEff");++ dumpNodes(new Path(webGraphDb), type, topN, new Path(output), asEff);return 0;}catch (Exception e) {