/// <summary> /// This is the process that Runs the Index Rebuild /// </summary> private void BuildIndexes() { var selected = new ListString(Registry.GetString("/Current_User/Rebuild Search Index/Selected")); var indexMap = new ListString(); foreach (Index str3 in SearchManager.Indexes) { this.BuildIndexCheckbox(str3.Name, str3.Name, selected, indexMap); } if (Config.Scaling.Enabled) { RemoteSearchManager.Initialize(); foreach (RemoteIndex str3 in RemoteSearchManager.Indexes) { this.BuildIndexCheckbox(str3.Name, str3.Name, selected, indexMap); } InMemorySearchManager.Initialize(); foreach (InMemoryIndex str3 in InMemorySearchManager.Indexes) { this.BuildIndexCheckbox(str3.Name, str3.Name, selected, indexMap); } } this.BuildIndexCheckbox("$system", "Quick search index", selected, indexMap); this.IndexMap = indexMap.ToString(); }
/// <summary> /// Given an Item, this will return the name of the Index that it will use to search on /// </summary> /// <returns>The Name of the Index</returns> /// <param name="item">The item which will be used to determine (based off the item path) which index will be used for the search</param> public static string GetContextIndex(Item item) { Contract.Requires(item.IsNotNull()); if (item.IsNotNull()) { RemoteSearchManager.Initialize(); foreach (var index in from index in RemoteSearchManager.Indexes let indexConfigurationNode = Configuration.Factory.GetConfigNode( "/sitecore/search/remoteconfiguration/indexes/index[@id='" + (index as RemoteIndex).Name + "']/locations/ItemBucketSearch/Root") where indexConfigurationNode != null where item.Paths.FullPath.StartsWith(indexConfigurationNode.InnerText) select index) { return((index as RemoteIndex).Name); } InMemorySearchManager.Initialize(); foreach (var index in from index in InMemorySearchManager.Indexes let indexConfigurationNode = Configuration.Factory.GetConfigNode( "/sitecore/search/inmemoryconfiguration/indexes/index[@id='" + (index as InMemoryIndex).Name + "']/locations/ItemBucketSearch/Root") where indexConfigurationNode != null where item.Paths.FullPath.StartsWith(indexConfigurationNode.InnerText) select index) { return((index as InMemoryIndex).Name); } foreach (var index in from index in Sitecore.Search.SearchManager.Indexes let indexConfigurationNode = Configuration.Factory.GetConfigNode( "/sitecore/search/configuration/indexes/index[@id='" + index.Name + "']/locations/ItemBucketSearch/Root") where indexConfigurationNode != null where item.Paths.FullPath.StartsWith(indexConfigurationNode.InnerText) select index) { return(index.Name); } } return("itembuckets_buckets"); }