public IndexCreatedEvent create(Index index){
  verifyTable(index.getDatabaseName(),index.getTableName());
  ValidationEngine.validateAndThrow(index);
  index.setActive(false);
  logger.debug("Creating index: " + index.toString());
  Index created=indexesRepo.create(index);
  long dataSize=tablesRepo.countTableSize(index.getDatabaseName(),index.getTableName());
  Date now=new Date();
  UUID uuid=UUID.randomUUID();
  IndexCreatedEvent toReturn=new IndexCreatedEvent(uuid,now,now,created,dataSize,0l);
  statusRepo.create(toReturn);
  toReturn.calculateValues();
  DomainEvents.publish(toReturn);
  return toReturn;
}

public IndexCreatedEvent create ( Index index ) { verifyTable ( index . getDatabaseName ( ) , index . getTableName ( ) ) ; ValidationEngine . validateAndThrow ( index ) ; index . setActive ( false ) ; logger . debug ( "Creating index: " + index . toString ( ) ) ; Index created = indexesRepo . create ( index ) ; long dataSize = tablesRepo . countTableSize ( index . getDatabaseName ( ) , index . getTableName ( ) ) ; Date now = new Date ( ) ; UUID uuid = UUID . randomUUID ( ) ; IndexCreatedEvent toReturn = new IndexCreatedEvent ( uuid , now , now , created , dataSize , 0l ) ; statusRepo . create ( toReturn ) ; toReturn . calculateValues ( ) ; DomainEvents . publish ( toReturn ) ; return toReturn ; }
creates an index . index will be created synchronously , but it will be populated asynchronously , and it will not be " active " ( meaning it can ' t be used for querying ) until indexing is complete . inactive indexes will still be populated by new records that are being inserted .
