SharePoint search Display Templates

bsim 1 Reputation point
2020-10-28T18:29:23.697+00:00

I've created a Display template to display my custom site column. That part is working fine, but I'm still seeing some hithighlighting from a field I've excluded from search. I'm also seeing at the beginning of the hithighlighting some text from my html. The text is from 4 navigation links at the top of my master page and for some reason they are being pulled into the hithighlighting even though no terms are matched. See pics below.

The other odd thing is even if I remove #=ctx.RenderBody(ctx)=# from my display template the hithighlighted text shows up. I would assume only my custom site column would be displayed?

35802-capture1.png35793-capture.png

SharePoint Server
SharePoint Server
A family of Microsoft on-premises document management and storage systems.
2,180 questions
SharePoint Server Development
SharePoint Server Development
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Development: The process of researching, productizing, and refining new or existing technologies.
1,564 questions
{count} votes

1 answer

Sort by: Most helpful
  1. bsim365 116 Reputation points
    2020-10-30T18:30:00.67+00:00

    SharePoint 2016 on prem. I defined the template by creating a new search display template. Then added my custom property in the managedpropertymaping section.
    Then in the body div I added the call to pull my custom properties:

    <div id="Pagetitle"><a href="#= ctx.CurrentItem.Path =# ">#= ctx.CurrentItem.Title =#</a></div><div id="PageDescrip">
    <br />Page Summary: #= ctx.CurrentItem.PageDescriptionOWSMTXT =#</div>

    After removing #=ctx.RenderBody(ctx)=# and clearing my browser cache i am no longer seeing that top hit highlighted text. however, based on the search results I can confirm the data that was returned in that hit highlighted text area is still being included in the search results, even though that column is excluded from searchable columns.

    The other part I can't figure out is why does text from the top navigation in the masterpage show in the hit highlighted summary at all? that text is not part of any field on pages in the site. It is only in the mastepage.

    0 comments No comments