mercredi 28 janvier 2015

How to retrieve value of type hyperlink from managed property in display template?



I have a site column of type HyperLink / Picture where the url for the icon is stored. I want to access this in the custom display template for search items.


Whenever I try to access the site column named ServiceIcon as described above, it retrieves null value. I have checked it using another tool whether any sort of value is being assigned to this managed property or not and it shows that correct value has been assigned to it. The following is the code:



<mso:ManagedPropertyMapping msdt:dt="string">'Title':'Title','Path':'Path','Description':'Description','EditorOWSUSER':'EditorOWSUSER','LastModifiedTime':'LastModifiedTime',
'CollapsingStatus':'CollapsingStatus','DocId':'DocId','HitHighlightedSummary':'HitHighlightedSummary','HitHighlightedProperties':'HitHighlightedProperties','FileExtension':'FileExtension',
'ViewsLifeTime':'ViewsLifeTime','ParentLink':'ParentLink','FileType':'FileType','IsContainer':'IsContainer','SecondaryFileExtension':'SecondaryFileExtension','DisplayAuthor':'DisplayAuthor','ServiceOffering':'ServiceOffering','ServiceColor':'ServiceColor','ServiceIcon':'ServiceIcon'

var pictureURL = $getItemValue(ctx, "ServiceIcon");
pictureURL.overrideValueRenderer($urlHtmlEncode);
alert("pic URL : " + pictureURL);


This alert displays null value. I have verified and the mapping with the crawled property has been done correctly. Please help.








0 commentaires:

Enregistrer un commentaire