private Boolean indexExists ( String labelName , List < String > propertyNames ) { Schema schema = db . schema ( ) ; for ( IndexDefinition indexDefinition : Iterables . asList ( schema . getIndexes ( Label . label ( labelName ) ) ) ) { List < String > properties = Iterables . asList ( indexDefinition . getPropertyKeys ( ) ) ; if ( properties . equals ( propertyNames ) ) { return true ; } } return false ; }
Checks if an index exists for a given label and a list of properties This method checks for index on nodes