Excluding Items Without Layouts From Being Indexed
Excluding Items Without Layouts From Being Indexed
Coveo for Sitecore (December 2016)
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 Changing 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.
- Open the
Coveo.SearchProvider.Custom.config
file. It’s usually located under<SITECORE_INSTANCE_ROOT>\Website\App_Config\Include\Coveo
. - Locate the
coveoInboundFilterPipeline
node. It’s located underpipelines
. -
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>
-
(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 thecontent
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>
-
Save and close the file.
- Rebuild your indexes (see Coveo for Sitecore Indexing Guide).