Exclude Items Without Layouts From Being Indexed

When indexing your items, you might want to exclude items that don’t have layouts, which can help reduce the total indexing time, and can reduce the size of your index. While you could do so by changing the crawling root of your index (see Change the Crawling Root of an Index), it can become time consuming when your items without layouts aren’t grouped at the same place.

Instead, you can decide to include the Coveo.SearchProvider.CoveoInboundFilters.HasLayoutInboundFilter processor, which automatically excludes items without layouts from being indexed.

  1. Open the Coveo.SearchProvider.Custom.config file. It’s usually located under [Sitecore instance root]\Website\App_Config\Include\Coveo.

  2. Locate the coveoInboundFilterPipeline node. It’s located under pipelines.

  3. In the coveoInboundFilterPipeline node, add the following node:

     <!-- Used to exclude items that don't have layouts from being indexed -->
     <processor type="Coveo.SearchProvider.CoveoInboundFilters.HasLayoutInboundFilter, Coveo.SearchProviderBase">
     </processor>
    
  4. (Optional) Specify a path on which to apply your processor. By default, the processor is applied to all of the Sitecore items.

    In your Sitecore instance, you kept the default crawling roots, which crawl items under /sitecore/content and under /Media Library/Files. You want to prevent items without layouts in the content branch from being indexed, but not in the /Media Library/Files one, which usually only contain items without layouts.

    In your processor, you add the following ApplyToPaths node.

     <!-- Used to exclude items that don't have layouts from being indexed -->
     <processor type="Coveo.SearchProvider.CoveoInboundFilters.HasLayoutInboundFilter, Coveo.SearchProviderBase">
       <ApplyToPaths>/sitecore/content</ApplyToPaths>
     </processor>
    
  5. Save and close the file.

  6. Rebuild your indexes (see Coveo for Sitecore Indexing Guide).

Recommended Articles