private void checkRepeatIndex(SchemaLabel schemaLabel) {
if (schemaLabel instanceof VertexLabel) {
VertexLabel vl = (VertexLabel) schemaLabel;
if (vl.idStrategy().isPrimaryKey()) {
List<String> pkFields = this.transaction.graph()
.mapPkId2Name(vl.primaryKeys());
E.checkArgument(!this.indexFields.containsAll(pkFields),
"No need to build index on properties %s, " +
"because they contains all primary keys %s " +
"for vertex label '%s'",
this.indexFields, pkFields, vl.name());
}
}
for (Id id : schemaLabel.indexLabels()) {
IndexLabel old = this.transaction.getIndexLabel(id);
if (this.indexType != old.indexType()) {
continue;
}
List<String> newFields = this.indexFields;
List<String> oldFields = this.transaction.graph()
.mapPkId2Name(old.indexFields());
E.checkArgument(!CollectionUtil.prefixOf(newFields, oldFields),
"Fields %s of new index label '%s' is prefix of " +
"fields %s of existed index label '%s'",
newFields, this.name, oldFields, old.name());
}
}