Exclude Items Without Layouts From Being Indexed
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, 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.
ExampleIn 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>
NoteUse a semicolon (
;
) to separate paths when specifying multiple paths in the<ApplyToPaths>
element. -
Save and close the file.
-
Rebuild your indexes (see Coveo for Sitecore Indexing Guide).