diff --git a/solr/contrib/uima/CHANGES.txt b/solr/contrib/uima/CHANGES.txt
index be2132e8f91..4196ba49d0b 100644
--- a/solr/contrib/uima/CHANGES.txt
+++ b/solr/contrib/uima/CHANGES.txt
@@ -24,6 +24,12 @@ $Id$
(No Changes)
================== 3.3.0-dev ==============
+
+New Features
+----------------------
+
+* SOLR-2582: Use uniqueKey for error log in UIMAUpdateRequestProcessor.
+ (Tommaso Teofili via koji)
Bug Fixes
----------------------
diff --git a/solr/contrib/uima/README.txt b/solr/contrib/uima/README.txt
index 6a602c99cca..9d45910666e 100644
--- a/solr/contrib/uima/README.txt
+++ b/solr/contrib/uima/README.txt
@@ -35,8 +35,9 @@ To start using Solr UIMA Metadata Extraction Library you should go through the f
never indexed documents entirely in your session. -->
true
+ If logField is not specified, uniqueKey will be used as logField.
id
+ -->
false
diff --git a/solr/contrib/uima/src/main/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessor.java b/solr/contrib/uima/src/main/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessor.java
index 9483a97cae9..8eff669ff09 100644
--- a/solr/contrib/uima/src/main/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessor.java
+++ b/solr/contrib/uima/src/main/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessor.java
@@ -21,6 +21,7 @@ import org.apache.solr.common.SolrException;
import org.apache.solr.common.SolrException.ErrorCode;
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.core.SolrCore;
+import org.apache.solr.schema.SchemaField;
import org.apache.solr.uima.processor.SolrUIMAConfiguration.MapField;
import org.apache.solr.uima.processor.ae.AEProvider;
import org.apache.solr.uima.processor.ae.AEProviderFactory;
@@ -44,6 +45,8 @@ public class UIMAUpdateRequestProcessor extends UpdateRequestProcessor {
SolrUIMAConfiguration solrUIMAConfiguration;
private AEProvider aeProvider;
+
+ private SolrCore solrCore;
public UIMAUpdateRequestProcessor(UpdateRequestProcessor next, SolrCore solrCore,
SolrUIMAConfiguration config) {
@@ -52,6 +55,7 @@ public class UIMAUpdateRequestProcessor extends UpdateRequestProcessor {
}
private void initialize(SolrCore solrCore, SolrUIMAConfiguration config) {
+ this.solrCore = solrCore;
solrUIMAConfiguration = config;
aeProvider = AEProviderFactory.getInstance().getAEProvider(solrCore.getName(),
solrUIMAConfiguration.getAePath(), solrUIMAConfiguration.getRuntimeParameters());
@@ -84,6 +88,12 @@ public class UIMAUpdateRequestProcessor extends UpdateRequestProcessor {
}
} catch (Exception e) {
String logField = solrUIMAConfiguration.getLogField();
+ if(logField == null){
+ SchemaField uniqueKeyField = solrCore.getSchema().getUniqueKeyField();
+ if(uniqueKeyField != null){
+ logField = uniqueKeyField.getName();
+ }
+ }
String optionalFieldInfo = logField == null ? "." :
new StringBuilder(". ").append(logField).append("=")
.append((String)cmd.getSolrInputDocument().getField(logField).getValue())
diff --git a/solr/contrib/uima/src/test/resources/solr-uima/conf/solrconfig.xml b/solr/contrib/uima/src/test/resources/solr-uima/conf/solrconfig.xml
index 4d58bd150da..192728d4c65 100644
--- a/solr/contrib/uima/src/test/resources/solr-uima/conf/solrconfig.xml
+++ b/solr/contrib/uima/src/test/resources/solr-uima/conf/solrconfig.xml
@@ -1064,8 +1064,6 @@
/TestExceptionAE.xml
true
-
- id
false