IndexStructure docdecl = new IndexStructure();
addMetaDataFieldDefinitions(registry, docdecl);
FieldDefinition uuidDef = FieldDefinition.create("uuid", FieldDefinition.KEYWORD);
uuidDef.setStore(true);
docdecl.addFieldDef(uuidDef);
FieldDefinition langDef = FieldDefinition.create("language", FieldDefinition.KEYWORD);
langDef.setStore(true);
docdecl.addFieldDef(langDef);
for (int j = 0; j < fields.length; j++) {
FieldDefinition fielddecl;
// field id attribute
String id_field = fields[j].getAttribute(ID_ATTRIBUTE);
// field type attribute
String typeS = fields[j].getAttribute(TYPE_ATTRIBUTE, "");
int type = FieldDefinition.stringTotype(typeS);
try {
fielddecl = FieldDefinition.create(id_field, type);
} catch (IllegalArgumentException e) {
throw new ConfigurationException("field " + id_field + " type " + typeS, e);
}
// field store attribute
boolean store;
if (fielddecl.getType() == FieldDefinition.TEXT) {
store = fields[j].getAttributeAsBoolean(STORE_ATTRIBUTE, false);
} else {
store = fields[j].getAttributeAsBoolean(STORE_ATTRIBUTE, true);
}
fielddecl.setStore(store);
// field dateformat attribute
if (fielddecl.getType() == FieldDefinition.DATE) {
String dateformat_field = fields[j].getAttribute(DATEFORMAT_ATTRIBUTE);
((DateFieldDefinition) fielddecl).setDateFormat(new SimpleDateFormat(
dateformat_field));
}