Published on:Dec 20, 2017
Views: 3006
Number of votes: 3
Average rating:

Staying under the document limit when using the Find developer index

When working on a site migration with a LOT of content we often find ourselves running up against the 10,000 document limitation on a developer index.

I learned this trick from a coworker. You can use an Initialization Module to get some fine-grained control over what is getting added to the index.

using System;
using System.Diagnostics;
using System.Linq;
using AlloyInitModuleTest.Models.Media;
using AlloyInitModuleTest.Models.Pages;
using EPiServer.Core;
using EPiServer.Find.ClientConventions;
using EPiServer.Find.Cms;
using EPiServer.Find.Cms.Conventions;
using EPiServer.Find.Cms.Module;
using EPiServer.Find.Framework;
using EPiServer.Framework;
using EPiServer.Framework.Initialization;

    public class SearchConventionInitializationModule : IInitializableModule
        public void Initialize(InitializationEngine context)
            //Add initialization logic, this method is called once after CMS has been initialized

    private void SetTypesToIndex(IContentIndexerConventions conventions)
        // start from a clean slate
        conventions.ForInstancesOf<ContentData>().ShouldIndex(x => false);

        //one by one turn on or off as you develop the site, remember to reindex 
        conventions.ForInstancesOf<ImageFile>().ShouldIndex(x => false);
        conventions.ForInstancesOf<GenericMedia>().ShouldIndex(x => false);
        conventions.ForInstancesOf<LandingPage>().ShouldIndex(x => true);

    public void Uninitialize(InitializationEngine context)
            //Add uninitialization logic

[Conditional("DEBUG")] allows us to limit this to debug builds and index everything in production.

Dec 20, 2017

( By eGandalf, 12/21/2017 3:18:19 PM)

Just learned a bit about managing the Find index like this, myself. The [Conditional("DEBUG")] attribute is a great tip! Thanks!

( By KennyG, 12/21/2017 3:54:21 PM)

Yeah, I could really use some actual Find training instead of just trying to tweak my coworkers' code.

Bob Bolt
( By Bob Bolt, 12/21/2017 5:01:30 PM)

Please login to comment.