You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nutch.apache.org by fe...@apache.org on 2012/08/31 14:49:26 UTC

svn commit: r1379431 - in /nutch/branches/2.x: CHANGES.txt src/java/org/apache/nutch/indexer/elastic/ElasticWriter.java

Author: ferdy
Date: Fri Aug 31 12:49:26 2012
New Revision: 1379431

URL: http://svn.apache.org/viewvc?rev=1379431&view=rev
Log:
NUTCH-1462 Elasticsearch not indexing when type==null in NutchDocument metadata

Modified:
    nutch/branches/2.x/CHANGES.txt
    nutch/branches/2.x/src/java/org/apache/nutch/indexer/elastic/ElasticWriter.java

Modified: nutch/branches/2.x/CHANGES.txt
URL: http://svn.apache.org/viewvc/nutch/branches/2.x/CHANGES.txt?rev=1379431&r1=1379430&r2=1379431&view=diff
==============================================================================
--- nutch/branches/2.x/CHANGES.txt (original)
+++ nutch/branches/2.x/CHANGES.txt Fri Aug 31 12:49:26 2012
@@ -2,6 +2,8 @@ Nutch Change Log
 
 Release 2.1 - Current Development
 
+* NUTCH-1462 Elasticsearch not indexing when type==null in NutchDocument metadata (ferdy)
+
 * NUTCH-1395 Show batchId when skipping within ParserJob (lewismc)
 
 * NUTCH-1365 Fix crawlId functionalilty by making using of new gora configuration (ferdy)

Modified: nutch/branches/2.x/src/java/org/apache/nutch/indexer/elastic/ElasticWriter.java
URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/indexer/elastic/ElasticWriter.java?rev=1379431&r1=1379430&r2=1379431&view=diff
==============================================================================
--- nutch/branches/2.x/src/java/org/apache/nutch/indexer/elastic/ElasticWriter.java (original)
+++ nutch/branches/2.x/src/java/org/apache/nutch/indexer/elastic/ElasticWriter.java Fri Aug 31 12:49:26 2012
@@ -58,8 +58,9 @@ public class ElasticWriter implements Nu
   @Override
   public void write(NutchDocument doc) throws IOException {
     String id = TableUtil.reverseUrl(doc.getFieldValue("url"));
-    IndexRequestBuilder request = client.prepareIndex(defaultIndex, doc
-        .getDocumentMeta().get("type"), id);
+    String type = doc.getDocumentMeta().get("type");
+    if (type == null) type = "doc";
+    IndexRequestBuilder request = client.prepareIndex(defaultIndex, type, id);
     
     Map<String, Object> source = new HashMap<String, Object>();