0

I am trying to customize search result through display template. I am customizing "Item_CommonItem_Body.html" file to include custom managed property in the place of title I am trying to put custom managed property

I created one variable

var xxx_subject = ctx.CurrentItem.DocSubjectXXX;

using same in

var titleHtml = String.format('<a clicktype="{0}" id="{1}" style="cursor: pointer;" class="ms-srch-item-link" title="{3}" onfocus="{4}" {5}>{6}</a>',
                                      $htmlEncode(clickType), $htmlEncode(id + Srch.U.Ids.titleLink), $urlHtmlEncode(url), $htmlEncode(ctx.CurrentItem.Title), 
                                      showHoverPanelCallback, appAttribs, xxx_subject);

But I am always getting empty value. But at the same time when I try to see with SharePoint 2013 Search Query Tool v2.1 I get the data. enter image description here

So I don't know what I am doing mistake !!!

1

Did you add the managed property mapping in the display template? Look for the tag starting with <mso:ManagedPropertyMaping in the head of the template. You need to add a mapping to your managed property. It should be in the following format:

'<current item property name>':'<managed property name>'

Yours should be like this:

'DocSubjectXXX':'DocSubjectXXX' // Managed properties are comma separated.

You can find more details here.

  • You hit the correct nail But I already did it and still it is showing blank :( – Milind Aug 28 '14 at 11:37
  • Other than making sure the list/library has been crawled, and that the managed property has been mapped to a crawled property, I'm not sure. – wjervis Aug 28 '14 at 11:55
  • Well I did Full Crawl + Incremental Crawl 4 to 5 time – Milind Aug 28 '14 at 12:53

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.