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 2013/05/28 09:35:34 UTC
svn commit: r1486792 - in
/lucene/dev/trunk/solr/contrib/uima/src/java/org/apache/solr/uima/processor:
UIMAToSolrMapper.java UIMAUpdateRequestProcessor.java
Author: tommaso
Date: Tue May 28 07:35:33 2013
New Revision: 1486792
URL: http://svn.apache.org/r1486792
Log:
SOLR-4865 - improved UIMA URP logging
Modified:
lucene/dev/trunk/solr/contrib/uima/src/java/org/apache/solr/uima/processor/UIMAToSolrMapper.java
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/UIMAToSolrMapper.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/contrib/uima/src/java/org/apache/solr/uima/processor/UIMAToSolrMapper.java?rev=1486792&r1=1486791&r2=1486792&view=diff
==============================================================================
--- lucene/dev/trunk/solr/contrib/uima/src/java/org/apache/solr/uima/processor/UIMAToSolrMapper.java (original)
+++ lucene/dev/trunk/solr/contrib/uima/src/java/org/apache/solr/uima/processor/UIMAToSolrMapper.java Tue May 28 07:35:33 2013
@@ -17,8 +17,6 @@ package org.apache.solr.uima.processor;
* limitations under the License.
*/
-import java.util.Map;
-
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.uima.processor.SolrUIMAConfiguration.MapField;
import org.apache.uima.cas.FSIterator;
@@ -29,6 +27,8 @@ import org.apache.uima.jcas.tcas.Annotat
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.util.Map;
+
/**
* Map UIMA types and features over fields of a Solr document
*
@@ -64,16 +64,18 @@ public class UIMAToSolrMapper {
String fieldNameFeatureValue = fieldNameFeature == null ? null :
fs.getFeatureValueAsString(type.getFeatureByBaseName(fieldNameFeature));
String fieldName = mapField.getFieldName(fieldNameFeatureValue);
- log.info(new StringBuilder("mapping ").append(typeName).append("@").append(featureName)
- .append(" to ").append(fieldName).toString());
+ if (log.isInfoEnabled()) {
+ log.info("mapping {}@{} to {}", new Object[]{typeName, featureName, fieldName});
+ }
String featureValue;
if (fs instanceof Annotation && "coveredText".equals(featureName)) {
featureValue = ((Annotation) fs).getCoveredText();
} else {
featureValue = fs.getFeatureValueAsString(type.getFeatureByBaseName(featureName));
}
- log.info(new StringBuilder("writing ").append(featureValue).append(" in ").append(
- fieldName).toString());
+ if (log.isDebugEnabled()) {
+ log.debug("writing {} in {}", new Object[]{featureValue, fieldName});
+ }
document.addField(fieldName, featureValue, 1.0f);
}
}
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=1486792&r1=1486791&r2=1486792&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 Tue May 28 07:35:33 2013
@@ -111,9 +111,9 @@ public class UIMAUpdateRequestProcessor
debugString = " null text";
}
if (solrUIMAConfiguration.isIgnoreErrors()) {
- log.warn(new StringBuilder("skip the text processing due to ")
+ log.warn("skip the text processing due to {}",new StringBuilder()
.append(e.getLocalizedMessage()).append(optionalFieldInfo)
- .append(debugString).toString());
+ .append(debugString));
} else {
throw new SolrException(ErrorCode.SERVER_ERROR,
new StringBuilder("processing error ")
@@ -150,7 +150,9 @@ public class UIMAUpdateRequestProcessor
/* process a field value executing UIMA the CAS containing it as document text */
private JCas processText(String textFieldValue) throws ResourceInitializationException,
AnalysisEngineProcessException {
- log.info(new StringBuilder("Analyzing text").toString());
+ if (log.isDebugEnabled()) {
+ log.debug("Analyzing text");
+ }
/* get the UIMA analysis engine */
AnalysisEngine ae = aeProvider.getAE();
@@ -160,7 +162,9 @@ public class UIMAUpdateRequestProcessor
/* perform analysis on text field */
ae.process(jcas);
- log.info("Text processing completed");
+ if (log.isDebugEnabled()) {
+ log.debug("Text processing completed");
+ }
return jcas;
}