本文整理汇总了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);
}
}