當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。