Gravatar for dwebb@habaneroconsulting.com

Question by dwebb, Feb 19, 2015 4:46 PM

ClickableUri passed to HtmlItemContentFetcher is not a valid URL

Hello -- I've implemented a pipeline stage which uses the HtmlItemContentFetcher class to retrieve a Sitecore page so that I can set the Body byte array (I copied the code from the Coveo.SearchProvider.Processors.HtmlContentInBodyWithRequestsProcessor class in Coveo.SearchProvidersBase.dll and made a couple of modifications -- to filter out non-page items or __standard-values, for example).

The class is working nicely, except that I've noticed something strange with the p_Args.CoveoItem.ClickableUri passed in to the arguments. The value in the ClickableUri is not valid -- it seems to contain the host name twice.

My Sitecore instance name is "test". Inside the Sitecore instance, I have two sites -- site1 and site2. The 2 sites have their own host headers.

So, for example, a valid url for a page in site 1 under the home page would be http://site1/sub-page-1.

However, when I'm inside the pipeline stage, the clickableUri contains http://test/site1/sub-page-1. So when I call the HtmlItemContentFetcher and pass the item's ClickableUri, I get a server error 500 and can't retrieve the page content.

Is this expected behaviour? I'm wondering if there's a setting somewhere that I haven't set properly, or a helper class which takes a clickableUri and can give me back a valid absolute or relative url that I could retrieve.

Cheers David

1 Reply
Gravatar for lbergeron@coveo.com

Answer by Luc Bergeron, Feb 20, 2015 3:12 PM

Hi,

Actually Coveo for Sitecore can use only one site when computing the clickableUri value. When using many sites, you should use the "CoveoPostItemProcessing" pipeline to set the right host name in the clickableUri value. You will find more information on these pages: https://developers.coveo.com/display/SC201502/Using+the+Coveo+Pipelines https://developers.coveo.com/display/SC201502/Indexing+Documents+with+Custom+Pipeline+Processor

However, the use case you are describing will be supported out-of-the-box with the March 2015 release of Coveo for Sitecore. It will detect the item site and use its host name when computing the clickableUri value.

I hope this helps

Gravatar for dwebb@habaneroconsulting.com

Comment by dwebb, Feb 20, 2015 3:59 PM

Awesome, thanks for the help. I ended up modifying the Clickable Uri as you described (in a different spot, but the same thing).

Ask a question