Skip to content

armgit / nutch

Public Imported from GitHub
0

Apache Nutch is an extensible and scalable web crawler

NUTCH-1004 Do not index empty values for title field

Markus Jelsma9669a558ee2a
diff --git a/CHANGES.txt b/CHANGES.txt
index e3cc231b7..9ddee3174 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -2,6 +2,8 @@ Nutch Change Log
Release 2.0 - Current Development
+* NUTCH-1004 Do not index empty values for title field (markus)
+
* NUTCH-914 Implement Apache Project Branding Requirements (lewismc via jnioche)
* NUTCH-1065 New mvn.template (lewismc)
diff --git a/src/plugin/index-basic/src/java/org/apache/nutch/indexer/basic/BasicIndexingFilter.java b/src/plugin/index-basic/src/java/org/apache/nutch/indexer/basic/BasicIndexingFilter.java
index fca5f0d9e..072119f32 100644
--- a/src/plugin/index-basic/src/java/org/apache/nutch/indexer/basic/BasicIndexingFilter.java
+++ b/src/plugin/index-basic/src/java/org/apache/nutch/indexer/basic/BasicIndexingFilter.java
@@ -95,8 +95,10 @@ public class BasicIndexingFilter implements IndexingFilter {
if (title.length() > MAX_TITLE_LENGTH) { // truncate title if needed
title = title.substring(0, MAX_TITLE_LENGTH);
}
- // add title indexed and stored so that it can be displayed
- doc.add("title", title);
+ if (title.length() > 0) {
+ // NUTCH-1004 Do not index empty values for title field
+ doc.add("title", title);
+ }
// add cached content/summary display policy, if available
ByteBuffer cachingRaw = page
.getFromMetadata(Nutch.CACHING_FORBIDDEN_KEY_UTF8);