当前位置: 首页>>代码示例>>Java>>正文


Java MapField.getFieldNameFeature方法代码示例

本文整理汇总了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);
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:37,代码来源:UIMAToSolrMapper.java

示例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);
  }
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:35,代码来源:UIMAToSolrMapper.java


注:本文中的org.apache.solr.uima.processor.SolrUIMAConfiguration.MapField.getFieldNameFeature方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。