Display Custom Property on Search Display Template (SharePoint Online)

Jyoti Rajpurohit 21 Reputation points
2022-12-17T14:17:02.12+00:00

Hi,

I'm currently trying to display a custom page property in the search result display template (Item_CommonItem_Body) of a SharePoint Online Classic site.

I have created and added the managed property to the ManagedPropertyMapping element as follows:

Item_CommonItem_Body.html:

<mso:ManagedPropertyMapping msdt:dt="string">'Path':'Path','Description':'Description','EditorOWSUSER':'EditorOWSUSER','LastModifiedTime':'LastModifiedTime','CollapsingStatus':'CollapsingStatus','DocId':'DocId','HitHighlightedSummary':'HitHighlightedSummary','owstaxIdBHFacility':'owstaxIdBHFacility','HitHighlightedProperties':'HitHighlightedProperties','FileExtension':'FileExtension','ViewsLifeTime':'ViewsLifeTime','ParentLink':'ParentLink','FileType':'FileType','IsContainer':'IsContainer','SecondaryFileExtension':'SecondaryFileExtension','DisplayAuthor':'DisplayAuthor','metadatafacetinfo':'metadatafacetinfo','ows_MetadataFacetInfo':'ows_MetadataFacetInfo'</mso:ManagedPropertyMapping>  

Search Schema Managed Property: Managed Property

271607-image.png

I see this property appearing with the SharePoint Search Query tool:

271608-image.png

but when I check the display template rendering of the same search result the property is not found (screenshot above is showing the internal property name which we have also tried referencing in the display template with same behavior):

271597-image.png

Anyone have any ideas as to what we could be missing here? All the articles and posts I've checked so far haven't worked. This property in question is a managed metadata term in case that makes a difference.

Microsoft 365 and Office | SharePoint | Development
Microsoft 365 and Office | SharePoint | For business | Windows
{count} votes

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 40,486 Reputation points Microsoft External Staff
    2022-12-19T08:21:39.74+00:00

    Hi @Jyoti Rajpurohit ,
    In display template add the "refinablestring00" to the managed property mapping like below

    <mso:ManagedPropertyMapping msdt:dt="string">'Title'{Title}:'Title','Department'{Department}:'RefinableString00'</mso:ManagedPropertyMapping>  
    

    Please refer to the following document for more details

    https://learn.microsoft.com/en-us/sharepoint/refinement-web-part?source=recommendations#change-the-display-name-for-a-refiner-in-the-classic-search-experience


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.