final ODatabaseRecord database = getDatabase();
final OIndex<?> idx;
if (fields == null || fields.length == 0) {
if (keyTypes != null)
idx = database.getMetadata().getIndexManager()
.createIndex(indexName, indexType.toString(), new OSimpleKeyIndexDefinition(keyTypes), null, null, metadataDoc, engine);
else if (serializerKeyId != 0) {
idx = database
.getMetadata()
.getIndexManager()
.createIndex(indexName, indexType.toString(), new ORuntimeKeyIndexDefinition(serializerKeyId), null, null, metadataDoc,