About the coveoResolveItemSite Pipeline

This pipeline uses the Coveo.SearchProvider.Pipelines.CoveoResolveItemsSiteArgs class and is used to resolve an item’s site at indexing time. The pipeline is invoked when computing an item clickable URI value. At indexing time, the site in the Sitecore context can’t be used because Sitecore resolves the site based on the URL used by the web browser to access the website. Usually, it would target the shell site.

Name Type Description

Item

Coveo.Framework.Items.IItem

The Sitecore item that’s being indexed.

ResolvedSiteName

System.String

The name of the Sitecore site that has been resolved. When the pipeline ends, the value of this property is used to compute the item clickable URI. When ResolvedSiteName is set to null, the default Sitecore site is used to compute the URI.

Configuration

In the Coveo.SearchProvider.config file, you can add your processor using the arguments under the coveoResolveItemSite element in the Coveo.SearchProvider.Custom.config file. To do so, copy the coveoResolveItemSite node from the Coveo.SearchProvider.config file, and paste it into your Coveo.SearchProvider.Custom.config file, under pipelines.

Important

Don’t modify the Coveo.SearchProvider.config file directly, as doing so may result in unforeseen upgrading issues.

By default, the ResolveItemSiteProcessor is enabled and will resolve to the first site that contains the item being indexed.

About the ResolveItemSiteProcessor Processor

This processor is responsible for resolving the site of a specific item. It’s particularly useful when dealing with many sites.

The work performed by this processor is straightforward:

  1. It scans the list of configured Sitecore sites.

  2. For each site, it checks whether the site name is excluded or not. In a clean install of Sitecore, all sites are excluded except the website one.

  3. It then checks if the item being indexed is located under the site Home item. If the answer is true, then the item site is resolved. Otherwise, it continues to the next site.

Extension Points

When you need to customize the behavior, you can safely remove or replace this processor. It’s also possible to inherit from the Coveo.SearchProvider.Processors.ResolveItemSiteProcessor class to take advantage of its extension points. You can override these methods to tailor the processor to your needs.

GetExcludedSiteNames

IEnumerable<string> GetExcludedSiteNames()

It returns the list of sites that are excluded from the site resolution process.

IsItemInSite

bool IsItemInSite(ISiteInfo p_SiteInfo, IItem p_Item)

Using the site configuration and the item being indexed, it checks if the item resides in the site.

ResolveItemSite

string ResolveItemSite(IItem p_Item)

This method wraps the whole site resolution process. It’s responsible for calling both the GetExcludedSiteNames and IsItemInSite methods. You may want to override this method to implement a custom fallback strategy. However, you can also add your own custom processor to the pipeline to achieve the same result.

What's next for me?