core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLRebuildIndex.java
public Object execute(final Map<Object, Object> iArgs) {
    if (name == null)
      throw new OCommandExecutionException("Cannot execute the command because it has not been parsed yet");

    final ODatabaseDocument database = getDatabase();
    if (name.equals("*")) {
      long totalIndexed = 0;
      for (OIndex<?> idx : database.getMetadata().getIndexManager().getIndexes()) {
        if (idx.isAutomatic())
          totalIndexed += idx.rebuild();
      }

      return totalIndexed;

    } else {
      final OIndex<?> idx = database.getMetadata().getIndexManager().getIndex(name);
      if (idx == null)
        throw new OCommandExecutionException("Index '" + name + "' not found");

      if (!idx.isAutomatic())
        throw new OCommandExecutionException("Cannot rebuild index '" + name
            + "' because it's manual and there aren't indications of what to index");

      return idx.rebuild();
    }
  }
public Object execute(final Map<Object, Object> iArgs) {
    if (name == null)
      throw new OCommandExecutionException("Cannot execute the command because it has not been parsed yet");

    final ODatabaseDocument database = getDatabase();
    if (name.equals("*")) {
      long totalIndexed = 0;
      for (OIndex<?> idx : database.getMetadata().getIndexManager().getIndexes()) {
        if (idx.isAutomatic())
          totalIndexed += idx.rebuild();
      }

      return totalIndexed;

    } else {
      final OIndex<?> idx = database.getMetadata().getIndexManager().getIndex(name);
      if (idx == null)
        throw new OCommandExecutionException("Index '" + name + "' not found");

      if (!idx.isAutomatic())
        throw new OCommandExecutionException("Cannot rebuild index '" + name
            + "' because it's manual and there aren't indications of what to index");

      return idx.rebuild();
    }
  }
public Object execute ( final Map < Object , Object > iArgs ) { if ( name == null ) throw new OCommandExecutionException ( "Cannot execute the command because it has not been parsed yet" ) ; final ODatabaseDocument database = getDatabase ( ) ; if ( name . equals ( "*" ) ) { long totalIndexed = 0 ; for ( OIndex < ? > idx : database . getMetadata ( ) . getIndexManager ( ) . getIndexes ( ) ) { if ( idx . isAutomatic ( ) ) totalIndexed += idx . rebuild ( ) ; } return totalIndexed ; } else { final OIndex < ? > idx = database . getMetadata ( ) . getIndexManager ( ) . getIndex ( name ) ; if ( idx == null ) throw new OCommandExecutionException ( "Index '" + name + "' not found" ) ; if ( ! idx . isAutomatic ( ) ) throw new OCommandExecutionException ( "Cannot rebuild index '" + name + "' because it's manual and there aren't indications of what to index" ) ; return idx . rebuild ( ) ; } }
Execute the REMOVE INDEX.
Execute the REMOVE INDEX .