November Happy Hour will be moved to Thursday December 5th.
AI OnAI Off
November Happy Hour will be moved to Thursday December 5th.
You should be able to use ordinary initializable module infrastructure:
[InitializableModule]
[ModuleDependency(typeof (IndexingModule))]
public class ContentIndexerConfig : IInitializableModule
{
public void Initialize(InitializationEngine context)
{
ContentIndexer.Instance.Conventions.ForInstancesOf<IContent>().ShouldIndex(_ => false);
ContentIndexer.Instance.Conventions.ForInstancesOf<EditorPage>().ShouldIndex(_ => true);
ContentIndexer.Instance.Conventions.EnablePageFilesIndexing();
FileIndexer.Instance.Conventions.ShouldIndexVPPConvention = new VisibleInFilemanagerVPPIndexingConvention();
}
public void Uninitialize(InitializationEngine context)
{
}
public void Preload(string[] parameters)
{
}
}
I prefer to specify what should be indexed, instead of what should not be indexed. I.e:
ContentIndexer.Instance.Conventions
.ForInstancesOf<ContentBasePage>()
.ShouldIndex(x => true);
Hi,
Thanks for the reply.
Sorry I didn't mentioned that I'm using EPiServer CMS 6 R2.
I have used below code :
[InitializableModule]
[ModuleDependency(typeof(IndexingModule))]
public class ContentIndexerConfig : IInitializableModule
{
public void Initialize(InitializationEngine context)
{
PageIndexer.Instance.Conventions.ForInstancesOf<PageData>().ShouldIndex(x => x.Category.IsIndexableCategoryList());
}
public void Uninitialize(InitializationEngine context)
{
}
public void Preload(string[] parameters)
{
}
}
And Extension method as :
public static bool IsIndexableCategoryList(this CategoryList pageCategoryList)
{
string categoryName = string.Empty;
Category IndexCategory = Category.Find("EPiServerFindIndexable");
if (pageCategoryList.Contains(IndexCategory.ID))
return true;
return false;
}
The Code worked just fine for me.
Thanks alot!
Hi Can someone help me how to use IInitializableModule for conditional Indexing of the connet.
Right now I'm using the following Code in global.asax.cs file to control Indexing of all the pages:
And the Extension method for Page Data as follows:
Is there any way to do the same with IInitializableModule?
Thanks.