public void Run(Sitecore.Install.Framework.ITaskOutput output, System.Collections.Specialized.NameValueCollection metaData) { try { var meta = metaData["Attributes"]; Sitecore.Diagnostics.Log.Info("Recommended Renderings Metadata:" + meta, this); var attribute = meta.Split('|')[0]; var attributeValue = attribute.Split('=')[1]; foreach (var s in attributeValue.Split(';')) { Sitecore.Diagnostics.Log.Info("Recommended Renderings Index: " + s, this); Sitecore.ContentSearch.ISearchIndex index = Sitecore.ContentSearch.ContentSearchManager.GetIndex(s); if (index != null) { index.Rebuild(Sitecore.ContentSearch.IndexingOptions.ForcedIndexing); } } } catch (Exception ex) { Sitecore.Diagnostics.Log.Error("Recommended Renderings Exception: " + ex, this); } }
/// <summary> /// Empty implementation. /// </summary> /// <param name="searchIndex">Search index.</param> public void Initialize(CS.ISearchIndex searchIndex) { Assert.ArgumentNotNull(searchIndex, "searchIndex"); Assert.ArgumentNotNullOrEmpty(searchIndex.Name, "searchIndex.Name"); if (!string.IsNullOrEmpty(this.RuleDatabaseName)) { return; } string[] parts = searchIndex.Name.Split('_'); if (parts.Length < 2) { return; } if (SC.StringUtil.Contains( parts[1], SC.Configuration.Factory.GetDatabaseNames())) { this.RuleDatabaseName = parts[1]; } }
public void Initialize(CS.ISearchIndex searchIndex) { }