Using the ItemPathInboundFilter
Using the ItemPathInboundFilter
You can restrict indexing to items located under specific paths in the Sitecore content tree. To do so, you need to add a processor of type ItemPathInboundFilter
in the coveoInboundFilterPipeline
node. This processor accepts the ContentStartPaths
node into which you enter the path(s) that are subject to indexing.
When using this method, the content outside of the specified path is still processed before being filtered out. The better practice would be to change the crawling root so these items aren’t analyzed at all (see Changing the Crawling Root of an Index).
To add the ItemPathInboundFilter processor
- Open the
SearchProvider.Custom.config
in a text editor (see Understanding the Coveo Search Provider Configuration File). - In the
<coveoInboundFilterPipeline>
node, add a<processor>
node with aCoveo.SearchProvider.CoveoInboundFilters.ItemPathInboundFilter, Coveo.SearchProviderBase
type. - In the
<processor>
node, add a<ContentStartPaths>
node. - In the
<ContentStartPaths>
node, add the path(s) you want to include in the index, each separated by a semi-colon. - Save and close the file.
- Rebuild your indexes (see Coveo for Sitecore Indexing Guide).
In the following example, we want to include all items under the /sitecore/content/Home/
and /sitecore/content/Developing-in-Sitecore/
paths (and therefore exclude everything else):
<coveoInboundFilterPipeline>
<processor type="Coveo.SearchProvider.CoveoInboundFilters.ItemPathInboundFilter, Coveo.SearchProviderBase">
<ContentStartPaths>/sitecore/content/Home/;/sitecore/content/Developing-in-Sitecore/</ContentStartPaths>
</processor>
</coveoInboundFilterPipeline>
The final slashes in the paths are important. For example, if you omit the final slash in the first path of the <contentStartPaths>
element above (that is, you indicate /sitecore/content/Home
as the path), an item such as /sitecore/content/Home Page
would match the path and be indexed, when your intention was probably only to index items within the Home
item in the content tree.