code: public void createSpatialIndex( String tableName, String geomColumnName ) throws Exception {
          if (geomColumnName == null) {
              geomColumnName = "the_geom";
          }
          String realColumnName = getProperColumnNameCase(tableName, geomColumnName);
          String realTableName = getProperTableNameCase(tableName);
          String sql = "CREATE SPATIAL INDEX ON " + realTableName + "(" + realColumnName + ");";
  
          execOnConnection(connection -> {
              try (IHMStatement stmt = connection.createStatement()) {
                  stmt.execute(sql.toString());
              }
              return null;
          });
  
      }
docs: Create a spatial index.
  
  @param tableName the table name.
  @param geomColumnName the geometry column name.
  @throws Exception