code: private int indexRows(TableIndex tableIndex, FeatureResultSet resultSet) {
  
  		int count = -1;
  
  		try {
  			while ((progress == null || progress.isActive())
  					&& resultSet.moveToNext()) {
  				if (count < 0) {
  					count++;
  				}
  				try {
  					FeatureRow row = resultSet.getRow();
  					boolean indexed = index(tableIndex, row.getId(),
  							row.getGeometry());
  					if (indexed) {
  						count++;
  					}
  					if (progress != null) {
  						progress.addProgress(1);
  					}
  				} catch (Exception e) {
  					log.log(Level.SEVERE, "Failed to index feature. Table: "
  							+ tableIndex.getTableName() + ", Position: "
  							+ resultSet.getPosition(), e);
  				}
  			}
  		} finally {
  			resultSet.close();
  		}
  
  		return count;
  	}
docs: Index the feature rows in the cursor
  
  @param tableIndex
  table index
  @param resultSet
  feature result
  @return count, -1 if no results or canceled