How to display values from custom managed properties in search results – option 1

This is a blog post in the series "How to change the way search results are displayed in SharePoint Server 2013." To demonstrate how you can customize your search results, I'll use examples from an internal Microsoft Search Center.

For an overview of the blog posts in this series, go to How to change the way search results are displayed in SharePoint Server 2013.

In the previous blog post, I introduced you to the Search Center example I am using in this series, and explained how you can create a new result type. In this blog post we'll learn:


How to display a custom icon

In a previous blog, I showed you how the icons Word, PDF and Excel are displayed for each search result. In my Search Center scenario, I wanted to add the following custom icon next to all search results that belong to the newly created TechNet content result type:

To display a custom icon for search results, here's what you should do:

  1. Add the custom icon to a SharePoint library.

    In my Search Center scenario, I added the custom icon to the Images library.

Icon in Images library

  1. Open the item display template that is referenced from the result type for which you want to display a custom icon.

    In my scenario, this was the TechNet content file.

  2. In the item display template, modify the value for ctx.CurrentItem.csr_Icon so that it points to the custom icon.

    In my scenario, I also removed the if statement, if(ctx.CurrentItem.IsContainer).

ctx.CurrentItem.csr_Icon points to custom icon

  1. On a search page, enter a query that will trigger the new result type.

    In my scenario, I entered "result type."  Search results that are TechNet publications now have a custom icon next to them. Great!

Custom icon displayed in search results

So users of our search center could now easily distinguish the search results that had been published on TechNet. However, I also wanted to add information from custom site columns so that users could see important information about each search result without having to click on it.

At the start of this series, I explained that site columns are “transformed” into managed properties during crawl. I also explained that only managed properties that are listed in an item display template can be displayed in search results. So, to display custom information in your search results, you need to add managed properties to an item display template. Hence, the next thing you should do is find the managed property name that corresponds to the custom site column that you want to use.


How to find a managed property name

Before you start searching for a managed property name, it’s important that you know a bit about the naming convention for managed properties. For more information about this, see Automatically created managed properties in SharePoint Server 2013.

Depending on your permission level, you can search for managed properties from three places:

Permission level From where you can search
Search service application administrator Central Administration --> Managed Service Application --> Search Service Application --> Search Schema
Site collection administrator Site Settings --> Search Schema (in the Site Collection Administration section)
Site collection owner Site Settings --> Schema (in the Search section)

To save space, I will only show you how to find a managed property name as a Site collection administrator.

Here’s what you should do:

  1. Go to Site settings --> Search Schema.

Search Schema on Site Settings page

  1. On the Managed Properties page, in the Managed property field, type the name of the site column that you want to find the managed property name of. Remember that managed property names don’t contain spaces, so if your site column name contains a space, leave it out.

    In my scenario, I wanted to find the managed property name for the site column Content Summary. I entered ContentSummary in the Managed property field, and clicked the green arrow icon.

Search for ContentSummary

One search result was returned: ContentSummaryOWSMTXT.

ContentSummaryOWSMTXT returned as search result

Since the Content Summary site column is of type Multiple lines of text, I knew that this was the managed property name that I wanted to use.

  1. Repeat the steps from this procedure to find the names of all of the managed properties that you want to display in your search results.

So now that you have found the names of the managed properties that you want to show in your search results, the next step is to modify the item display template.



How to modify an item display template to show values from custom managed properties - option 1

As I explained in the previous blog, there are different ways you can go about modifying an item display template to show values from custom managed properties. The first option I'll show you is very simple (I’ll cover the second option in the next blog). It does not include any if statements, and hit highlighting is not applied.

Here's what you should do:

  1. Open the item display template that belongs to the result type for which you want to customize search results.

    In my scenario, this was TechNet content.

  2. In the item display template, in the ManagedPropertyMapping tag, use the following syntax to add the custom managed properties that you want to display:
    '<Current item property name>':<Managed property name>'

    In my scenario, I wanted the values from the managed properties ContentSummaryOWSMTXT and owstaxIdTechnicalSubject to be displayed in the search result. To make the file easier to maintain, I named the current item properties the same as the managed properties.

Two managed Properties added to display template

  1. Inside the second <div> tag in the <body>, use the following syntax to add code that will display the value of the custom managed property:
    _#= ctx.CurrentItem.<Current item property name> =#_

    In my scenario, I added the following to the item display template:
    <div>_#= ctx.CurrentItem. ContentSummaryOWSMTXT =#_</div>
    <div>_#= ctx.CurrentItem. owstaxIdTechnicalSubject =#></div>

Add properties so that they display in search results

  1. Save the item display template.
  2. NOTE: You do not need to do this step if you are using SharePoint Online.
    Go to Site settings --> Search Result Types. Notice that a Property Sync alert is displayed.

Property Sync alert displayed

This alert is displayed because we added managed properties to an item display template (what we did in step 2). To update the result types with the newly added managed properties, click Update.

Update managed Properties from result types

IMPORTANT! If you don't do this update, the newly added managed properties will not display in your search results.

After I made this change, when users entered a query in our Search Center, both the value of ContentSummaryOWSMTXT and the value for owstaxIdTechnicalSubject were displayed in the search results.

Values of custom properties displayed in search results
But even though two custom properties were now displayed in our search results, I wasn’t quite happy with the result. For example, I wanted to display the two custom properties between the title and the link, and not below the link as was currently the case.

To better understand why the search results were displayed the way they were, let's take a closer look at the customized item display template:

How the display template displays content

  1. ctx.CurrentItem.csr_Icon points to the location of my custom icon. This variable is used by the Item_CommonItem_Body display template.
  2. _#=ctx.RenderBody(ctx)=#_ calls the Item_CommonItem_Body display template (remember, I talked about this in an earlier blog post). The Item_CommonItem_Body display template displays the custom icon, title and the link to the item.
  3. _#= ctx.CurrentItem.ContentSummaryOWSMTXT =#_ and _#= ctx.CurrentItem.owstaxIdTechnicalSubject =#_ display the values of the two managed properties, ContentSummaryOWSMTXT and owstaxIdTechnicalSubject.

To display the custom properties between the title and the link, you could simply take the Item_CommonItem_Body display template out of play by deleting the reference _#=ctx.RenderBody(ctx)=#_ from your custom display template. You could then add the properties in the order that you want them to display, for example like this:

Reference to _#=ctx.RenderBody(ctx)=#_ has been deleted

The search result would then look like this:

Search result displayed without Item_CommonItem_Body reference

By working a bit more on the styling, you could have a good enough result. However, by deleting the reference to _#=ctx.RenderBody(ctx)=#_ ,the Item_CommonItem_Body display template is no longer used to display results. The Item_CommonItem_Body display template contains some functionality that will automatically improve the relevancy of your search results. So, before you delete the _#=ctx.RenderBody(ctx)=#_ reference, you should consider if automatically improved relevancy is something that the users of your search site would benefit from.


About click tracking and automatically improved relevancy

The Item_CommonItem_Body display template contains an onlick method that tracks the click behavior of users. This tracking has an impact on the relevancy of search results. For example, a search result that is often clicked by users will automatically be displayed higher up in the search results. 

IMPORTANT: If you want your search results to receive automatically improved relevancy based on the click behavior of users, do not delete the reference to _#=ctx.RenderBody(ctx)=#_ from the item display template!

In the next blog post, I will show you how you can keep this reference, display custom properties between the title and link in the search results, and also apply hit highlighting to your custom properties.


Next blog post in this series
How to display values from custom properties in search results - option 2

Comments (57)
  1. Bella_Engen says:

    Hi Gaurav,

    It depends on which Search Web Part you are using to display your results. For an overview of the default display templates, see this article:

    Hope this helps,

  2. Bella_Engen says:

    Hi Thomas,

    Very interesting question! Unfortunately I don’t know how you can remove this prefix.
    Sorry I couldn’t be more helpful.


  3. Bella_Engen says:

    Hi Nancy,

    The default icons are supposed to "just work", so I can't say why this is not the case in your environment. I suggest you contact Microsoft customer support with this question.

    Regarding the empty property value. After you modified your display template, did you go to the Manage Result Types page and update your properties?


  4. Bella_Engen says:

    Hi Matthew,

    Yes, you can display a picture in your search results. And yes, you do have to add the managed property of your image to your display template.

    In this blog post you can see another example of how this can be done:

    Hope this helps.


  5. Bella_Engen says:

    Hi SharePointer101,

    I am not sure I completely understand your scenario, but from what I understand, you should create a managed property that contains only the crawled property for “Department”, and use this in your display template.


  6. Bella_Engen says:

    Hi Iranna,

    You can read about how to modify display templates in this article:


  7. Bella_Engen says:

    Hi Louie,

    Please contact MS Support with this issue.


  8. Great article! I've been bit by the property sync update problem more than once. I have managed to display custom string properties, but I would like to see an example of how to other datatypes and especially multi value properties.

    We have int32 int64, boolean, GUID, DateTime, Double, Decimal and byte array datatypes. And then there are single- and multi-value variants of each of these.

    Maybe something for a follow-up article?

  9. Bella_Engen says:

    Hi Gaurav,

    You should be able to make these changes to the Item_Powerpoint.html display template as well. It’s difficult for me to say what your exact issue could be, so I suggest that you contact Microsoft Support.


  10. Bella_Engen says:

    Hi Bhargav,

    The site column type should not matter.
    Are you seeing the Property sync alert for other site column values?


  11. Bella_Engen says:

    Hi Nancy,

    If I understand you correctly, you want to display a custom icon. Did you follow the steps I describe here:

    Also, what exactly is happening when you try to display a custom managed property? Do you get an error message, or does the value of the managed property not display correctly?


  12. Bella_Engen says:

    Hi Dan,

    Thanks for the feedback.

    I will look into expanding with examples of other data types, but can’t promise anything.


  13. Bella_Engen says:

    Hi Gaurav,

    It’s difficult to say anything about your specific problem, but did you make sure to add valid managed properties to your custom display template?

    If so, then I suggest that you contact Microsoft Support for further assistance.


  14. Bella_Engen says:

    Hi Avinash,

    The title gets truncated because of hit highlighting. To change this, you’ll have to modify your display template.

    If you use the Item_CommonItemBody display template, in the var titleHtml, try to replace the Srch.U.trimTitle….. with title.

    Hope this helps.


  15. Bella_Engen says:

    Hi Rupali,

    It’s a bit difficult to say why you are not seeing the Property sync alert, but have you verified that your custom managed property is added correctly to the display templates?


  16. Bella_Engen says:

    Hi Olaf,

    Sorry, I don’t have any ideas for how you can get around this.
    I suggest that you contact Microsoft Support.


  17. Anonymous says:

    Hi Bella, thanks för a great article!
    I have a issue with the results and the managed property coming from a managed metadata site column. the result is showing the GUID number like this "GP0|#8bcf1be9-c29e-4e42-aefb-6e1e36dd950e;L0|#08bcf1be9-c29e-4e42-aefb-6e1e36dd950e|Flex;"
    Do you know if is posible to delete this?

    Thank you!

  18. Bella_Engen says:

    Hi Petr,

    I’m still a bit unsure of what you’re trying to achieve, but by modifying the display template, you should be able to use your managed metadata field as the "Title" of your search results.


  19. Bella_Engen says:

    Hi Petr,

    I’m sorry, I don’t quite understand your question. Do you want to display a managed property name in the search results? Could you maybe give me some more information about the scenario that you want to achieve?


  20. Bella_Engen says:

    Hi AJ,

    I suggest that you contact Microsoft Support with your question.


  21. Bella_Engen says:

    Hi Adrian,

    Yes, you can modify display templates in SharePoint Online as well. You have to find the display template that your Search Results Web Part is using, and then modify its display template to show your property.


  22. Bella_Engen says:

    Hi Mike,

    After you'd changed your display template, on your Manage Result Types page, was a Property Sync alert shown? If not, try to save your custom display template again, and check to see if the Property Sync alert is shown. When you see this alert, make sure that you click to update the properties.

    Hope this helps,

  23. Bella_Engen says:

    Hi micmor81,

    I’m sorry, but I don’t know the answer to your question 🙁
    I suggest you contact Microsoft Support.


  24. Bella_Engen says:

    Hi Rock,

    For a LIST column, you first have to create a manage property, and then map the correct crawled property. See this TechNet article for information on how you can do this:

    Hope this helps,

  25. Bella_Engen says:

    Hi Counie,

    I believe the web or site name is captured in a managed property, but I don’t know the name of this managed property. Sorry!

    I suggest you contact Microsoft Support with your question.


  26. ghazal says:

    I have a question I would appreciate it if you can help me, how we can prevent displaying GUIDs within the hithighlightedsummary value in the search results page??

  27. Bella_Engen says:

    Hi ghazal,

    Unfortunately, this is currently not possible.


  28. Rafael says:

    I have a question. I have a problem with other column that I created. I think that the problem is the names.

    My question is:

    <Current item property name> is internal name of list?

    <Managed property name> is name of schema?


  29. Bella_Engen says:

    Hi Rafael,

    I’m sorry, but I don’t quite understand your question.

    Could you give me some more details about your problem?


  30. Iranna says:

    how to use jquery in item template say in Picture on left, 3 lines on right.
    Please suggest.

  31. Iranna says:

    Thanks for quick reply and link

  32. SharePointer101 says:

    Hi, I have a managed property "Department" which is mapped to "Company" and "Department" crawled properties.Now when I add the managed property in a display template, the results display both the "Company" and "Department" values. I want it to return results
    that match either Company or department but display only the corresponding "Department". What should my item value be ? ctc.CurrentItem.Department.something?

  33. Rupali says:

    Hi Bella,

    I have changed Display template to have manged property for out of box available property SPContentType.

    Although after going to Search result types, I dont see any Property sync alert. I have a on premise installation of SharePoitn 2013.
    Please guide, what could be going wrong.
    Thanks in Advance

  34. Nancy says:

    Hi Bella,
    I have created the custom display template and referred it in the Search Results Web part.
    I am facing an issue with the Results icon when custom Display Template is applied.
    With default Display template , the results icons are coming OOB but for custom it’s not coming.
    Is there any configuration change or something needs to be added to the Custom Display Template to get the Results icon OOB?

  35. Nancy says:

    In addition to the Results icon query, I have one more doubt regarding default Display Template. I unable to display custom managed property in Item_Default.html. I have added it in "ManagedPropertyMapping" tag also and trying to print the value as suggested by you in above post.

  36. Nancy says:

    Thanks Bella for the quick reply…. I am able to add the custom icon but i wanted to know that why i am not getting the default icons which sharepoint 2013 provides. I am not changing anything on the custom display template still the icons are missing whereas if default display template is applied, the icons for pdf, word etc documents are coming by default. As you have described in the below blog:

    On managed Property part, the property value is coming blank with default Display Template even if the value is there in the particular manage property. Its not throwing any error.

  37. thomas says:

    Hi Bella, great article! I hope you have time to share your wisdom of why the following is happening:
    I have a calculated column with this formula: =TEXT(Created,"yyyymmddhhmmss").
    I have created a managed property that maps to the calculated columns crawled property.
    I use the managed property as a refiner in my search page.

    When values from the calculated column show up in the refiner, they are prefixed with "string;#". Is there any way to configure the managed properties to only hold the specific value (and not include the string:# prefix)?

  38. Avinash says:

    I am using Sharepoint 2013 and sharepoint 2013 search.

    when i search for certain items i get results, but the title of certain items shows with a trailing dots after showing some characters of the title and truncating the rest.

    For example: let the title be "This is a sample title just for testing" and in the search result the title is shown as "This is a sample title just….". So aftre displaying some part of the title it is showing … I need to hover over the item to see the full title.Is there any option to show the full title.

  39. Bhargav says:

    Hi Bella great article.
    As per mentioned steps I had added the '':' and also require div tag.
    But after changes it is not showing "Property Sync" alert. My Custom column type is "Person or Group" so any other configuration required for this type?

  40. Matthew says:

    Bella, Thanks for your great blog posts. Is it possible to have a picture show up in the results? I have a thumbnail field in my list item, and would love to have that show up. Is it as simple as replacing that field with a managed property in the template?

  41. Anonymous says:

    Pingback from SharePoint Search | Share your knowledge

  42. gaurav says:

    Hi Bella,
    I followed your article about how to display values from custom managed properties in search results
    but still in the search results I am not able to see the custom managed properties, it's showing blank.


  43. gaurav says:

    Hi Bella,
    And also I am not able to see the sync update alert in the manage result type.


  44. gaurav says:

    Hi Bella,
    I am editing the Item_Powerpoint.html display template and doing the changes that you have mention in the article, if I am going wrong then please suggest.


  45. Anonymous says:

    This is a blog post in the series "How to change the way search results are displayed in SharePoint

  46. gaurav says:

    Hi Bella,

    Can you please tell us, the results which are coming from BCS in sharepoint 2013 search, for that which display template should be modified. Our aim is to display the custom icon with the results of BCS in search.


  47. Musheer says:

    Very helpful and nicely illustrated.

  48. Louie Medina says:

    Hi Bella!

    I have created a new field, added it to a new custom type then deployed the solution to a site collection. I created new managed properties mapped to the crawled properties in Central Admin and all the fields showed up. I then added new columns(URL's) to the
    custom content type, repeated the steps I took when I initially deployed the solution but the new properties do not show up as part of the ctx.CurrenItem object. I double-checked my Item display template to make sure that the new managed properties were declared,
    yet, the new properties will not show up as part of CurrentItem object.

    Any ideas why?

    Thanks in advance,

  49. Petr says:

    Hi Bella,

    thank you for all the knowledge you are sharing!

    I have little question:
    Is there a way to display managed property name (managed metadata) instead of title?

    Thank you

  50. Petr says:

    Hi Bella,

    sorry for that. I want to display certain column value (with link to that file). For example: By default, results are displayed like Title, link etc. I have a column that is called "Metadata" that is populated with managed metadata like "Invoice". What I'm
    trying to achieve is to display in results on first place "Invoice" with link to that document instead of a title of the document.
    Is it possible?

    Thank you very much


  51. Adrian says:

    I'm using SharePoint online and using a search webpart on a specific sitepage. Now when I hit search I want the search results to show a property I have on a library right beside the document name. For example "Document Name – (Property Here)" is this
    possible with this solution ? I can't seem to find the

    on the I opened the sitepage I'm using in SP Designer

    Thanks in advance

  52. AJ says:

    Hi, I'm trying this solution to show a column value I have in a document library. The column is a choice and I added it to manage property and also mapped it to that specific column. I added

    _#= ctx.CurrentItem.CourseID =#_

    but it's not showing in the search 🙁 What am I Missing ? I'm using office 365

  53. olaf says:

    Hi Bella,

    I try to modify a display template on a team site collection where the publishing infrastructure feature is not activated. Since there are no html files in the display templates folder, I changed the Item_CommonItem_Body.js.

    This is working so far as expected, with one exception: I added a ManagedPropertyMapping ('SiteTitle':['SiteTitle']) in the script and added it in the item property as well, but I am not able to retrieve the SiteTitle. I am not sure if I have to do a Search
    Result Types Property Sync – at least there is no warning (this probably is a publishing infrastructure feature?). Well, I'm a bit lost at the moment, maybe you have an idea to go on? Activating the publishing infrastructure feature is not an option, since
    it brings a lot of complexity we don't need at that point.

    Thanks in advance (and for your great series of articles)

  54. mike says:

    Great article, I followed it to a tee. I updated the template to include my managed property in the _#= ctx.CurrentItem.owstaxIdToolset =#_ and nothing shows up. I can do a metadata search toolset: html and it returns the documents I want but does not
    display the data in the body. Are there additional setup steps in Search Center or something that I may have missed?


  55. Counie says:

    Hi Bella,
    I'm hoping you could advise me.
    In my search results I'd like to include the web or site name where the item resides. In my environment the full URL path is displayed by default in the result block, however the web name is not displayed.
    e.g. the URL is "……./filename.
    Can you advise how I would display the Web Name only ? I think it would be very useful to my users to be able to see the web/site name moreso than the other components of the URL.
    Thanks and regards,

  56. Rock says:

    Hi Bella, Great article. Question for you: Can you find a managed property value for a column from a LIST rather than a SITE column?

Comments are closed.

Skip to main content