public void AddIndex(ISearchIndex index)
{
Assert.ArgumentNotNull(index, "index");
Assert.IsFalse((this.Indexes.ContainsKey(index.Name) ? 1 : 0) != 0, "An index with the name \"{0}\" have already been added.", index.Name);
this.Indexes[index.Name] = index;
if (index.Configuration == null)
{
XmlNode configNode = this.factory.GetConfigNode(this.DefaultIndexConfigurationPath);
if (configNode == null)
throw new ConfigurationException("Index must have a ProviderIndexConfiguration associated with it. Please check your config.");
ProviderIndexConfiguration @object = this.factory.CreateObject<ProviderIndexConfiguration>(configNode);
if (@object == null)
throw new ConfigurationException("Unable to create configuration object from path specified in setting 'ContentSearch.DefaultIndexConfigurationPath'. Please check your config.");
index.Configuration = @object;
}
if (!index.Configuration.InitializeOnAdd)
return;
index.Initialize();
}