reCreateIndex(label, propertyMethodMetadata);
}
}
private void reCreateIndex(Label label, PrimitivePropertyMethodMetadata propertyMethodMetadata) {
PropertyMetadata propertyMetadata = ((PrimitivePropertyMethodMetadata<PropertyMetadata>) propertyMethodMetadata).getDatastoreMetadata();
IndexDefinition index = findIndex(label, propertyMetadata.getName());
//TODO propertyMethodMetadata is always != null
if (propertyMethodMetadata != null && index == null) {
LOGGER.info("Creating index for label {} on property '{}'.", label, propertyMetadata.getName());
graphDatabaseService.schema().indexFor(label).on(propertyMetadata.getName()).create();
} else if (propertyMethodMetadata == null && index != null) {
LOGGER.info("Dropping index for label {} on properties '{}'.", label, index.getPropertyKeys());
index.drop();
}
}