Gravatar for gagarwal@rightpoint.com

Question by Gaurav Agarwal, Mar 22, 2017 3:31 PM

Highlight Text other than Title?

Hi All,

According to documentation we have 2 things -

1) <%=highlight(excerpt, excerptHighlights)%>

2) <%=highlight(title, titleHighlights)%>

So bottom is working with title field but I also want to highlight text other than title field. I have fields Like Firstname or BodyCopy. I also want that if search term matches in these field's value then term should also highlight in these as well. Is this achievable? I tried these with both options but didn't work for me.

1 Reply
Gravatar for slangevin@coveo.com

Answer by Simon, Mar 22, 2017 4:23 PM

Yes it is, you need to use the highlightStreamText helper method.

<%=highlightStreamText(myfield)%>


In this blog you have an example for Coveo for Sitecore:

{{= highlightStreamText(raw.@(Model.ToCoveoFieldName("myfield", false)) }}

Ask a question