Rebuilding the Flat Index for a Single Store View

If you have created many Magento store views and need to "quickly" rebuild an index, you may have to wait quite a long time (with lots of products in the catalog). It would be great if you could specifically rebuild just one store view's index.

I have made a start with the flat catalog index:

<?php

require_once 'app/Mage.php';

Mage::app('admin');

$indexer = Mage::getSingleton('catalog/product_flat_indexer');
$indexer->rebuild(22);

Simply replace the "22" with the ID of your own store view.