Use the Sitecore LinkManager to resolve URIs

Warning
Legacy feature

The Coveo Hive Framework is now in maintenance mode and is no longer recommended for new implementations.

To build new search experiences, use one of Coveo’s more modern, lightweight, and responsive libraries. To get started, see the Build search article.

This page explains how to use the Sitecore LinkManager to resolve search result clickable URIs on a Coveo Hive search page.

What’s the LinkManager

The LinkManager is a module of Sitecore used to resolve clickable URIs. For example, you may only want to display relative URIs, or add the current item language to its URI. The LinkManager is particularly useful in a multi-site configuration, where an item can be accessed via different URIs that seem completely unrelated to each other.

For example, if you have the following structure under the Content node:

Screenshot of the Sitecore content tree showing my site 1 my site 2 and shared items containing page 1 page 2 and a shared page items respectively | Coveo

And if your Sites node in your <SITECORE_INSTANCE_ROOT>\App_Config\Sitecore.config file looks like this:

<site name="mysite1" hostName="www.mysite1.ca" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content" startItem="/mysite1" language="en" database="web" domain="extranet" enableWebEdit="true" />
<site name="mysite2" hostName="www.mysite2.ca" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content" startItem="/mysite2" language="en" database="web" domain="extranet" enableWebEdit="true" />

Given the above configuration, the required IIS bindings, and a properly configured hosts file, it’s possible to access the page1 item via the URI www.mysite1.ca/page1 and the page2 item via the URI www.mysite2.ca/page2. This would also allow you to access the page2 item with the following URI: www.mysite1.ca/mysite2/page2.

The ResolveResultClickableUriProcessor

On a Coveo Hive search page, the Sitecore LinkManager configures your clickable URIs. This configuration comes from the execution of the ResolveResultClickableUriProcessor processor, which you can find in your <SITECORE_INSTANCE_ROOT>\App_Config\Modules\Coveo\Coveo.SearchProvider.Rest.config file.

Important

Don’t modify the Coveo.SearchProvider.Rest.config file directly. You should instead implement your modifications in the <SITECORE_INSTANCE_ROOT>\App_Config\Include\Coveo\Coveo.SearchProvider.Rest.Custom.config file, to prevent upgrade issues.

<coveoProcessParsedRestResponse>
  <processor type="Coveo.SearchProvider.Rest.Processors.CoveoProcessParsedRestResponse.ResolveResultClickableUriProcessor, Coveo.SearchProvider.Rest" />
</coveoProcessParsedRestResponse>
Note

This processor uses the following fields: syssource and uri. If you plan on removing one of these fields, insert your processor after this one.

Configuring the LinkManager

  1. Configure the <sites> node of the Sitecore configuration (see Configure multiple managed websites).

  2. Change the Sitecore site resolving settings, if necessary. Look for the nodes named Rendering.SiteResolving, Rendering.SiteResolvingMatchCurrentLanguage, and Rendering.SiteResolvingMatchCurrentSite in the <settings> node of the Sitecore configuration. Explanations for each setting are provided in the configuration file.

  3. Configure the format of URIs that are to be resolved in the <linkManager> section of the Sitecore.config file.

Tip

For complex clickable URI host name resolution issues, consider disabling the ResolveResultClickableUriProcessor processor and using an indexing pipeline extension (IPE) to set the clickable URI at indexing time. See Example: Replacing the hostname in the clickable URI for instructions and a code sample.