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

  1. Open the SearchProvider.Custom.config in a text editor (see Understanding the Coveo Search Provider Configuration File).
  2. In the <coveoInboundFilterPipeline> node, add a <processor> node with a Coveo.SearchProvider.CoveoInboundFilters.ItemPathInboundFilter, Coveo.SearchProviderBase type.
  3. In the <processor> node, add a <ContentStartPaths> node.
  4. In the <ContentStartPaths> node, add the path(s) you want to include in the index, each separated by a semi-colon.
  5. Save and close the file.
  6. 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):

  <processor type="Coveo.SearchProvider.CoveoInboundFilters.ItemPathInboundFilter, Coveo.SearchProviderBase">

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.