manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1461452 - /manifoldcf/trunk/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchIndex.java
Date Wed, 27 Mar 2013 08:52:46 GMT
Author: kwright
Date: Wed Mar 27 08:52:46 2013
New Revision: 1461452

URL: http://svn.apache.org/r1461452
Log:
Don't presume ES can generate null values for fields; this doesn't appear to work right now.
 Part of CONNECTORS-642.

Modified:
    manifoldcf/trunk/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchIndex.java

Modified: manifoldcf/trunk/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchIndex.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchIndex.java?rev=1461452&r1=1461451&r2=1461452&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchIndex.java
(original)
+++ manifoldcf/trunk/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchIndex.java
Wed Mar 27 08:52:46 2013
@@ -46,7 +46,13 @@ public class ElasticSearchIndex extends 
   protected final static String allowAttributeName = "allow_token_";
   /** The deny attribute name */
   protected final static String denyAttributeName = "deny_token_";
-
+  /** The no-security token */
+  protected final static String noSecurityToken = "__nosecurity__";
+  
+  /** Flag set as to whether null_value works in ES.  Right now it doesn't work,
+  * so we have to do everything in the connector. */
+  protected final static boolean useNullValue = false;
+  
   private class IndexRequestEntity implements HttpEntity
   {
 
@@ -172,9 +178,16 @@ public class ElasticSearchIndex extends 
     throws IOException
   {
     String metadataACLName = allowAttributeName + aclType;
-    needComma = writeField(pw,needComma,metadataACLName,acl);
+    if (acl != null && acl.length > 0)
+      needComma = writeField(pw,needComma,metadataACLName,acl);
+    else if (!useNullValue)
+      needComma = writeField(pw,needComma,metadataACLName,new String[]{noSecurityToken});
     String metadataDenyACLName = denyAttributeName + aclType;
-    return writeField(pw,needComma,metadataDenyACLName,denyAcl);
+    if (denyAcl != null && denyAcl.length > 0)
+      needComma = writeField(pw,needComma,metadataDenyACLName,denyAcl);
+    else if (!useNullValue)
+      needComma = writeField(pw,needComma,metadataDenyACLName,new String[]{noSecurityToken});
+    return needComma;
   }
 
   protected static String jsonStringEscape(String value)



Mime
View raw message