Gravatar for

Question by yonico, Mar 15, 2015 4:31 PM

CoveoSearch.ascx and values from Sitecore

Hi - I am trying to get some string fields from sitecore in order to use it inside CoveoSearch.ascx. For others sublayouts we are using the code behind to get content from sitecore. Is there a way to do it in Coveo?

Also, coveo is using the server name in the click uri, how can I get the url with the hostname instead of the server? Is there an impact if we change the ServerUrl in coveosearchProvider?

Gravatar for

Comment by Jean-François L'Heureux, Mar 16, 2015 9:17 AM

This question/answer site is built to have only one question per post because it can only have one accepted answer per post. Please create a separate question for the "server name in the click uri".

1 Reply
Gravatar for

Answer by Jean-François L'Heureux, Mar 16, 2015 9:16 AM

In Coveo for Sitecore, the search results comes in JSON from a REST request made from the client browser. It is not possible to use only ASP.Net code behind to get the results fields. To display a field, you must use our JavaScript UI framework (see Displaying a Field and Adding Images to Your Search Page for examples of JavaScript code that gets fields values). Since the field names are decorated by default with an "f" prefix and a number suffix, you still need to use ASP.Net code behind to compute the final field name to display (the <%= ToCoveoFieldName("SitecoreFieldName") %> part in the examples).

Ask a question