You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by to...@apache.org on 2016/01/11 09:16:45 UTC
svn commit: r1723983 - in /lucene/dev/branches/branch_5x: ./ solr/
solr/contrib/
solr/contrib/uima/src/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessor.java
Author: tommaso
Date: Mon Jan 11 08:16:45 2016
New Revision: 1723983
URL: http://svn.apache.org/viewvc?rev=1723983&view=rev
Log:
SOLR-6622 - using all field values in UIMAUpdateRequestProcessor
Modified:
lucene/dev/branches/branch_5x/ (props changed)
lucene/dev/branches/branch_5x/solr/ (props changed)
lucene/dev/branches/branch_5x/solr/contrib/ (props changed)
lucene/dev/branches/branch_5x/solr/contrib/uima/src/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessor.java
Modified: lucene/dev/branches/branch_5x/solr/contrib/uima/src/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessor.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/contrib/uima/src/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessor.java?rev=1723983&r1=1723982&r2=1723983&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/contrib/uima/src/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessor.java (original)
+++ lucene/dev/branches/branch_5x/solr/contrib/uima/src/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessor.java Mon Jan 11 08:16:45 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;