Try our conversational search powered by Generative AI!

Index only specific pages


I have a requirement to index only certain pages our site based on certain Categories. From other threads I came to know that its possible using the ShouldIndex convention, something like the following:

PageIndexer.Instance.Conventions.ForInstancesOf<PageData>().ShouldIndex(x => IsIndexableCategory(x));

1) Is it advisable to put the above convention in Appication_Start event of Global.asax.cs file? Else should I use InitializableModule and define it there?

2) For this requirement is it advisable to use the default EPiServer Find Scheduled job by specifying the ShouldIndex convention? Else can I define a separate Custom Find Scheduled job, wherein I filter pages based on desired criteria and index them alone? In this case will the pages get re-indexed automatically when respective page is re-published?

Apr 13, 2013 10:37

I would recommend using a InitializableModule, that way you can more easily structure your code. You can have multiple Initializable Modules throughout your project, but just one global.asax.

If you're defining conventions like ShouldIndex, they are also applied when the editor publishes a page and so on, not just when the scheduled job is running.

If you're doing your own scheduled job, Find can't obviously know what to index when a page is published.

Apr 13, 2013 12:31

I recommend you use the existing job and like Johan says creates an InitializableModule where you set the conventions that you want. These will then be used when ever the job is runned or when saving/deleting a page.


Apr 14, 2013 10:58
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.