The following code should do the trick:
using Microsoft.Office.Server.Administration;
using Microsoft.Office.Server.Search.Administration;
public static void ResetContent()
{
try
{
SearchContext sc = SearchContext.GetContext(ServerContext.Default);
sc.Reset(true);
}
catch (Exception ex)
{
throw new InvalidOperationException("Unable to reset content index.", ex);
}
}
certdev.com