本文整理匯總了Java中org.apache.solr.uima.processor.SolrUIMAConfiguration.MapField.getFieldNameFeature方法的典型用法代碼示例。如果您正苦於以下問題:Java MapField.getFieldNameFeature方法的具體用法?Java MapField.getFieldNameFeature怎麽用?Java MapField.getFieldNameFeature使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.solr.uima.processor.SolrUIMAConfiguration.MapField
的用法示例。
在下文中一共展示了MapField.getFieldNameFeature方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: map
import org.apache.solr.uima.processor.SolrUIMAConfiguration.MapField; //導入方法依賴的package包/類
/**
* map features of a certain UIMA type to corresponding Solr fields based on the mapping
*
* @param typeName name of UIMA type to map
*/
void map(String typeName, Map<String, MapField> featureFieldsmapping) throws FieldMappingException {
try {
Type type = cas.getTypeSystem().getType(typeName);
for (FSIterator<FeatureStructure> iterator = cas.getFSIndexRepository().getAllIndexedFS(type); iterator
.hasNext(); ) {
FeatureStructure fs = iterator.next();
for (String featureName : featureFieldsmapping.keySet()) {
MapField mapField = featureFieldsmapping.get(featureName);
String fieldNameFeature = mapField.getFieldNameFeature();
String fieldNameFeatureValue = fieldNameFeature == null ? null :
fs.getFeatureValueAsString(type.getFeatureByBaseName(fieldNameFeature));
String fieldName = mapField.getFieldName(fieldNameFeatureValue);
if (log.isInfoEnabled()) {
log.info("mapping {}@{} to {}", new Object[]{typeName, featureName, fieldName});
}
String featureValue = null;
if (fs instanceof Annotation && "coveredText".equals(featureName)) {
featureValue = ((Annotation) fs).getCoveredText();
} else {
featureValue = fs.getFeatureValueAsString(type.getFeatureByBaseName(featureName));
}
if (log.isDebugEnabled()) {
log.debug("writing {} in {}", new Object[]{featureValue, fieldName});
}
document.addField(fieldName, featureValue, 1.0f);
}
}
} catch (Exception e) {
throw new FieldMappingException(e);
}
}
示例2: map
import org.apache.solr.uima.processor.SolrUIMAConfiguration.MapField; //導入方法依賴的package包/類
/**
* map features of a certain UIMA type to corresponding Solr fields based on the mapping
*
* @param typeName name of UIMA type to map
*/
void map(String typeName, Map<String, MapField> featureFieldsmapping) throws FieldMappingException {
try {
Type type = cas.getTypeSystem().getType(typeName);
for (FSIterator<FeatureStructure> iterator = cas.getFSIndexRepository().getAllIndexedFS(type); iterator
.hasNext(); ) {
FeatureStructure fs = iterator.next();
for (String featureName : featureFieldsmapping.keySet()) {
MapField mapField = featureFieldsmapping.get(featureName);
String fieldNameFeature = mapField.getFieldNameFeature();
String fieldNameFeatureValue = fieldNameFeature == null ? null :
fs.getFeatureValueAsString(type.getFeatureByBaseName(fieldNameFeature));
String fieldName = mapField.getFieldName(fieldNameFeatureValue);
log.info(new StringBuffer("mapping ").append(typeName).append("@").append(featureName)
.append(" to ").append(fieldName).toString());
String featureValue = null;
if (fs instanceof Annotation && "coveredText".equals(featureName)) {
featureValue = ((Annotation) fs).getCoveredText();
} else {
featureValue = fs.getFeatureValueAsString(type.getFeatureByBaseName(featureName));
}
log.info(new StringBuffer("writing ").append(featureValue).append(" in ").append(
fieldName).toString());
document.addField(fieldName, featureValue, 1.0f);
}
}
} catch (Exception e) {
throw new FieldMappingException(e);
}
}