title: Magento API: Rebuild Indexes after adding new products
body: <p>I am currently writing a script that lets me import multiple products in magento. </p>
  
  <pre><code>$product = Mage::getModel('catalog/product');
  $product-&gt;setSku($data['sku']);
  //etc etc
  $product-&gt;save();
  </code></pre>
  
  <p>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. </p>
  
  <p>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. </p>
  
  <p>Caching is completely disabled. </p>
  
  <p>Now my question is: How can I rebuild the indexes after importing my products?</p>