- Indexing Strategies
- Excluding Sitecore Items from Your Coveo Index
- Indexing Item Content for Relevance
- Understanding How The ClickableUri Value Is Computed
- Rebuilding a Search Index
- Analyzing the Rebuild Process
- How Coveo for Sitecore Handles Sitecore Access Rights
- Indexing Performance Leading Practices
- Managing Sitecore Content in the Coveo Cloud Platform
- Browsing Through Indexed Fields
- Advanced Indexing Customizations
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 search interface receives search results from the index (see Using the Sitecore LinkManager to Resolve URIs in a Coveo Search Page).
Before diving into the configuration details, here are the steps used to compute the URI.
- Find the item site.
- Use the Link Manager to get the item URL.
- Apply the
Step 1 - Find the Item Site
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 is not specified,
website is used.
Step 2 - Use the Link Manager to Get the Item URL
Once the site is found, it is 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 hostname that appears in the computed URL. The hostname that comes out depends mostly on the
targetHostName values that are set on the site configuration.
targetHostName are defined, the instance name is used as the hostname, giving a URL that looks like this.
In this case,
sc7 is the name of the Sitecore instance.
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.
It is 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 cannot guess the right hostname, it simply falls back to the instance name.
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.
Step 3 - Apply the serverUrl Configuration
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:
And that the
serverUrl is configured like this:
Then the item URL will change to:
If the URL produced by the Link Manager was this one:
serverUrl value configured above, then the URL would remain unchanged.