/// <summary> /// Deletes the earlier indexes. /// </summary> /// <param name="product">The product.</param> /// <param name="processor">The processor.</param> private void DeleteEarlierIndexes(Product product, XmlProcessor processor) { DateTime deleteFrom = product.IndexStartDate; DateTime deleteUntil = DateTime.Today.AddDays(-31); string indexLocation = ConfigurationManager.AppSettings.Get("IndexFolder") + product.ProductName.ToString(); List <string> docList = new List <string>(); LuceneIndexer li = new LuceneIndexer(); while (deleteFrom < deleteUntil) { foreach (string server in ConfigurationManager.AppSettings.Get(ProductionServers + product.ProductName.ToString()).Split(',')) { docList.Add(processor.GetFilePath(product, deleteFrom, server)); } deleteFrom = deleteFrom.AddDays(1); } li.DeleteIndex(indexLocation, docList); UpdateProductDate(product, deleteUntil, "IndexStartDate"); }