Dec 20, 2017
visibility 5477
star star star star star
(3 votes)

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;


    [InitializableModule]
    [ModuleDependency(typeof(EPiServer.Web.InitializationModule))]
    public class SearchConventionInitializationModule : IInitializableModule
    {
        public void Initialize(InitializationEngine context)
        {
            //Add initialization logic, this method is called once after CMS has been initialized
            this.SetTypesToIndex(ContentIndexer.Instance.Conventions);
    }

    [Conditional("DEBUG")]
    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

Comments

eGandalf
eGandalf Dec 21, 2017 03:18 PM

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

KennyG
KennyG Dec 21, 2017 03:54 PM

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

error Please login to comment.
Latest blogs
Upgrading to the new Optimizely brand UI: update CMS and Commerce Connect together

On October 27 , we released Optimizely CMS 13.5.0 with the new Optimizely brand UI: a new logo, colors, fonts and icons, and a redesigned login pag...

Bien Nguyen | Dec 1, 2026

Headless PaaS CMS 13 Masterclass, Part 3: Creating an empty CMS 13 project

Set up an empty Optimizely CMS 13 project with Opti ID and Optimizely Graph, plus a Next.js front end that reads its start page through the officia...

Michał Mitas | Dec 1, 2026 |

Optimizely Leads Both Axes in Gartner’s 2026 DXP Magic Quadrant

Gartner’s November 23, 2026 Magic Quadrant for Digital Experience Platforms places Optimizely highest on Ability to Execute and furthest right on...

Augusto Davalos | Dec 1, 2026

107,068 New CVE Records, 326 CISA KEV Additions: What to Patch First, and Four Calls for 2027

From January to November 2026 NVD published 107,068 CVE records, 2.5× the same months of 2025. CISA's catalog of known exploited vulnerabilities...

Piotr | Dec 1, 2026 |