public FieldType(Element config, AnalyzerConfig analyzers) throws DatabaseConfigurationException {
if (LuceneConfig.FIELD_TYPE_ELEMENT.equals(config.getLocalName())) {
id = config.getAttribute(ID_ATTR);
if (StringUtils.isEmpty(id))
throw new DatabaseConfigurationException("fieldType needs an attribute 'id'");
}
String aId = config.getAttribute(ANALYZER_ID_ATTR);
// save Analyzer for later use in LuceneMatchListener
if (aId != null && aId.length() > 0) {
analyzer = analyzers.getAnalyzerById(aId);
if (analyzer == null)
throw new DatabaseConfigurationException("No analyzer configured for id " + aId);
analyzerId = aId;
} else {
analyzer = analyzers.getDefaultAnalyzer();
}
String boostAttr = config.getAttribute(BOOST_ATTRIB);
if (boostAttr != null && boostAttr.length() > 0) {
try {
boost = Float.parseFloat(boostAttr);
} catch (NumberFormatException e) {
throw new DatabaseConfigurationException("Invalid value for attribute 'boost'. Expected float, " +
"got: " + boostAttr);
}
}
String storeAttr = config.getAttribute(STORE_ATTRIB);