THIS IS ARCHIVED DOCUMENTATION

Understanding How The ClickableUri Value Is Computed

The clickable URI value is critical when attempting to navigate from a result page to the item that was indexed. When dealing with many sites and host names, it can be hard to get the URI that you want. The goal of this article is to explain how the clickable URI is computed at indexing time.

The clickable URI is also computed whenever a Coveo-powered search interface receives search results from the index (see Using the Sitecore LinkManager to Resolve URIs in a Coveo-Powered Search Page).

Overview

Before diving into the configuration details, here are the steps used to compute the URI.

  1. Find the item site.
  2. Use the Link Manager to get the item URL.
  3. Apply the serverUrl configuration.

Step 1: Find the Item Site

First, the coveoResolveItemSite pipeline is invoked to resolve the best site for the current item (see Understanding the coveoResolveItemSite Pipeline). If this pipeline is unable to resolve to a suitable site, then the default site is used. The default site can be defined in the Coveo Search Provider configuration file using the siteName element (see Understanding the Coveo Search Provider’s Configuration File). When the siteName element isn’t specified, website is used.

Once the site is found, it’s up to the Link Manager to compute the item URL using the appropriate URL options. Several options are available on the Link Manager, so the URL that comes out differs from one environment to another. Here is how it works with the default Link Manager.

The most important part is probably the host name that appears in the computed URL. The host name that comes out depends mostly on the hostName and targetHostName values that are set on the site configuration.

When no hostName or targetHostName are defined, the instance name is used as the host name, giving a URL that looks like this.

http://sc7/en/home.aspx

In this case, sc7 is the name of the Sitecore instance.

When the hostName is specified, it shows in the URL. The site configuration looks like this.

<site name="website" hostName="sample.local" ... />

The URL then looks like this.

http://sample.local/en/home.aspx

It’s also possible to use wildcards in the hostName attribute so that the same site configuration match many domains.

<site name="website" hostName="sample.*" ... />

Since the Link Manager can’t guess the right host name, it simply falls back to the instance name.

http://sc7/en/home.aspx

When using wildcards in the hostName attribute, you should also provide a value for the targetHostName attribute. The site configuration now looks like this.

<site name="website" hostName="sample.*" targetHostName="sample.net" ... />

It now produces this URL.

http://sample.net/en/home.aspx

Step 3: Apply the serverUrl Configuration

The serverUrl setting is defined in the Coveo.SearchProvider.Custom.config file (see Understanding the Coveo Search Provider’s Configuration File). This setting serves two purposes. The primary purpose is related to security and is beyond the scope of this article. The second purpose is to influence the item URL. Specifying a serverUrl value changes the item URL only when the URL produced by the Link Manager contains the instance name. Assuming that the Link Manager produced this URL:

http://sc7/en/home.aspx

And that the serverUrl is configured like this:

<serverUrl>http://sample.net/</serverUrl>

Then the item URL will change to:

http://sample.net/en/home.aspx

If the URL produced by the Link Manager was this one:

http://sample.local/en/home.aspx

Given the serverUrl value configured above, then the URL would remain unchanged.