List of usage examples for org.apache.solr.common.util NamedList get
public T get(String name, int start)
From source file:org.topicquests.solr.uima.processor.SolrUIMAConfigurationReader.java
License:Apache License
@SuppressWarnings("rawtypes") private Map<String, Map<String, MapField>> readTypesFeaturesFieldsMapping() { Map<String, Map<String, MapField>> map = new HashMap<String, Map<String, MapField>>(); NamedList fieldMappings = (NamedList) args.get("fieldMappings"); /* iterate over UIMA types */ for (int i = 0; i < fieldMappings.size(); i++) { NamedList type = (NamedList) fieldMappings.get("type", i); String typeName = (String) type.get("name"); Map<String, MapField> subMap = new HashMap<String, MapField>(); /* iterate over mapping definitions */ for (int j = 0; j < type.size() - 1; j++) { NamedList mapping = (NamedList) type.get("mapping", j + 1); String featureName = (String) mapping.get("feature"); String fieldNameFeature = null; String mappedFieldName = (String) mapping.get("field"); if (mappedFieldName == null) { fieldNameFeature = (String) mapping.get("fieldNameFeature"); mappedFieldName = (String) mapping.get("dynamicField"); }/*from ww w. jav a 2s . c o m*/ if (mappedFieldName == null) throw new RuntimeException( "either of field or dynamicField should be defined for feature " + featureName); MapField mapField = new MapField(mappedFieldName, fieldNameFeature); subMap.put(featureName, mapField); } map.put(typeName, subMap); } return map; }