I am currently writing a script that lets me import multiple products in magento.
$product = Mage::getModel('catalog/product');
$product->setSku($data['sku']);
//etc etc
$product->save();
The product gets created perfectly but it won't show up in my frontend until I either save it in the backend (without changing anything!) OR I rebuild the indexes in the backend.
I did a diff on the relevant database tables to see what's changing when I save the product and added those fields to my import script, but it did not have any effect. The imported product has to be OK since it shows up when I rebuild the indexes via the backend manually.
Caching is completely disabled.
Now my question is: How can I rebuild the indexes after importing my products?