1

I am trying to make the search results coming back within the common item body template slightly more user friendly. At the moment it appears that a managed property called hitHighlightedSummary is writing out a jumbled mass of properties.

I would like to write out the "Description" or "Synopsis" managed properties. The template itself already contains "Description" within the ManagedPropertyMapping tag. I have edited the template to contain the following, but the description seems to be blank.

<!--#_          
    var desc = Srch.U.getHighlightedProperty(id, ctx.CurrentItem, "Description");
    if ($isEmptyString(desc)) {desc = $htmlEncode(ctx.CurrentItem.Description)} 
_#-->           
    <div>Site Description  _#= desc =#_ End</div>

While looking into this I found a number of resources which mentioned that at this point I should have been presented with a banner on the Results Type page with a link which allowed me to sync properties. This has not happened.

Any guidance on what I may have missed would be great.

0

I don't think you missed anything, you will only see that banner if you've added a new managed property to that mso:ManagedPropertyMapping line in the head section. Since Description was already there and you are just using it in the body of your template you haven't done anything that would require you to resync.

  • Hi Mike, that certainly is the case for Description. However I did add the Synopsis property to this list and experience the same behaviour. – Scott Hulme Mar 9 '16 at 17:50
  • Sorry Scott. It may be that you are trying to update default result types and SharePoint doesn't like that. Maybe try creating a custom result type and display template? This might help too: sharepoint.buban.eu/?p=58 – Mike Lutge Mar 9 '16 at 18:12
0

Mike you appear to be correct. I created a new Search Display Template, taking a duplicate of the existing Common Item Body template. I made the exact same changes, uploaded it into the search templates directory, created a result type using the template and worked first time.

I'm still a bit bitter at the fact that I could alter the appearance of the existing template but seemingly unable to add a new managed property. There is nothing to indicate that this is the case.

Anywho, thanks for advise :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.