lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tomm...@apache.org
Subject svn commit: r1723982 - /lucene/dev/trunk/solr/contrib/uima/src/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessor.java
Date Mon, 11 Jan 2016 08:12:37 GMT
Author: tommaso
Date: Mon Jan 11 08:12:37 2016
New Revision: 1723982

URL: http://svn.apache.org/viewvc?rev=1723982&view=rev
Log:
SOLR-6622 - using all field values in UIMAUpdateRequestProcessor

Modified:
    lucene/dev/trunk/solr/contrib/uima/src/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessor.java

Modified: lucene/dev/trunk/solr/contrib/uima/src/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessor.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/contrib/uima/src/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessor.java?rev=1723982&r1=1723981&r2=1723982&view=diff
==============================================================================
--- lucene/dev/trunk/solr/contrib/uima/src/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessor.java
(original)
+++ lucene/dev/trunk/solr/contrib/uima/src/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessor.java
Mon Jan 11 08:12:37 2016
@@ -102,19 +102,13 @@ public class UIMAUpdateRequestProcessor
           logField = uniqueKeyField.getName();
         }
       }
-      String optionalFieldInfo = logField == null ? "."
-          : new StringBuilder(". ")
-              .append(logField)
-              .append("=")
-              .append(
-                  (String) cmd.getSolrInputDocument().getField(logField)
-                      .getValue()).append(", ").toString();
+      String optionalFieldInfo = logField == null ? "." : ". " + logField + "=" + cmd.getSolrInputDocument().
+          getField(logField).getValue() + ", ";
       int len;
       String debugString;
       if (text != null && text.length() > 0) {
         len = Math.min(text.length(), 100);
-        debugString = new StringBuilder(" text=\"")
-            .append(text.substring(0, len)).append("...\"").toString();
+        debugString = " text=\"" + text.substring(0, len) + "...\"";
       } else {
         debugString = " null text";
       }
@@ -124,9 +118,8 @@ public class UIMAUpdateRequestProcessor
             new StringBuilder().append(e.getLocalizedMessage())
                 .append(optionalFieldInfo).append(debugString));
       } else {
-        throw new SolrException(ErrorCode.SERVER_ERROR, new StringBuilder(
-            "processing error ").append(e.getLocalizedMessage())
-            .append(optionalFieldInfo).append(debugString).toString(), e);
+        throw new SolrException(ErrorCode.SERVER_ERROR, "processing error " + e.getLocalizedMessage()
+
+            optionalFieldInfo + debugString, e);
       }
     }
     super.processAdd(cmd);
@@ -142,16 +135,27 @@ public class UIMAUpdateRequestProcessor
     if (merge) {
       StringBuilder unifiedText = new StringBuilder("");
       for (String aFieldsToAnalyze : fieldsToAnalyze) {
-        unifiedText.append(String.valueOf(solrInputDocument
-            .getFieldValue(aFieldsToAnalyze)));
+        if (solrInputDocument.getFieldValues(aFieldsToAnalyze) != null) {
+          Object[] Values = solrInputDocument.getFieldValues(aFieldsToAnalyze).toArray();
+          for (Object Value : Values) {
+            if (unifiedText.length() > 0) {
+              unifiedText.append(' ');
+            }
+            unifiedText.append(Value.toString());
+          }
+        }
       }
       textVals = new String[1];
       textVals[0] = unifiedText.toString();
     } else {
       textVals = new String[fieldsToAnalyze.length];
       for (int i = 0; i < fieldsToAnalyze.length; i++) {
-        textVals[i] = String.valueOf(solrInputDocument
-            .getFieldValue(fieldsToAnalyze[i]));
+        if (solrInputDocument.getFieldValues(fieldsToAnalyze[i]) != null) {
+          Object[] Values = solrInputDocument.getFieldValues(fieldsToAnalyze[i]).toArray();
+          for (Object Value : Values) {
+            textVals[i] += Value.toString();
+          }
+        }
       }
     }
     return textVals;



Mime
View raw message