Apache Nutch is an extensible and scalable web crawler
Fail faster when looking for TITLE and BASE tags. These are only in HEAD, so we can stop once we see the BODY.
Douglass Cuttinga7014499737c
diff --git a/src/plugin/parse-html/src/java/org/apache/nutch/parse/html/DOMContentUtils.java b/src/plugin/parse-html/src/java/org/apache/nutch/parse/html/DOMContentUtils.javaindex 1517f8009..4901acc5c 100644--- a/src/plugin/parse-html/src/java/org/apache/nutch/parse/html/DOMContentUtils.java+++ b/src/plugin/parse-html/src/java/org/apache/nutch/parse/html/DOMContentUtils.java@@ -146,6 +146,9 @@ public class DOMContentUtils {* @return true if a title node was found, false otherwise*/public static final boolean getTitle(StringBuffer sb, Node node) {+ if ("body".equalsIgnoreCase(node.getNodeName())) // stop after HEAD+ return false;+if (node.getNodeType() == Node.ELEMENT_NODE) {if ("title".equalsIgnoreCase(node.getNodeName())) {getText(sb, node);@@ -169,6 +172,11 @@ public class DOMContentUtils {// is this node a BASE tag?if (node.getNodeType() == Node.ELEMENT_NODE) {++ if ("body".equalsIgnoreCase(node.getNodeName())) // stop after HEAD+ return null;++if ("base".equalsIgnoreCase(node.getNodeName())) {NamedNodeMap attrs = node.getAttributes();for (int i= 0; i < attrs.getLength(); i++ ) {