final ODocument metadata = getMetadata();
final boolean mergeSameKey = metadata != null && (Boolean) metadata.field(OIndex.MERGE_KEYS);
if (mergeSameKey) {
return (ODocument) previousRecord.getRecord();
} else
throw new ORecordDuplicatedException(String.format(
"Cannot index record %s: found duplicated key '%s' in index '%s' previously assigned to the record %s", iRecord,
iKey, getName(), previousRecord), previousRecord.getIdentity());
}
return super.checkEntry(iRecord, iKey);
}