Cannot get document tags to display as links in Smart Search Results transformation

Cassandra Snyder asked on December 19, 2014 16:06

I am trying to display the document tags as links on a search results page that uses the Smart Search Results webpart. I can get the tags to display as I want them on the individual pages, but the same transformation code does not display the document tags within the search results. This is the code that I'm using to display the tags on the individual pages: <%# IfEmpty(Eval("DocumentTags"),"", CMS.Blogs.BlogTransformationFunctions.GetDocumentTags(Eval("DocumentTagGroupID"), Eval("DocumentTags"), "/tagged")).ToString() %> and that is working as I expect. However, that same code doesn't display the document tags from those pages in the search results. I tried this code: <%# GetSearchValue(IfEmpty(Eval("DocumentTags"),"", CMS.Blogs.BlogTransformationFunctions.GetDocumentTags(Eval("DocumentTagGroupID"), Eval("DocumentTags"), "/tagged")).ToString()) %> in the transformation for the search results webpart but that did not change the outcome. I've attached some images to illustrate what I'm seeing on the site. Is there a special method that I need to use for pulling in the document tags as links in search results like they appear on the individual pages? Can anyone shed some light on this?

No tags in search results No tags in search results

Tags on page Tags on page

Correct Answer

Boris Pocatko answered on December 22, 2014 01:44


Please take a look at our documentation:

smart search transformation

The issue is, that the smart search result data set contains a limited set of data, compared to a repeater, containing all document (page) fields. You need to use the GetSearchValue method, instead of the Eval method for some of the fields. You can find the data columns, which you can access directly with the Eval method in the search results transformation in this article (sorry for the low quality image):

custom data in smart search transformations

So, you can use Eval("title") or Eval("score"), but for other fields, the GetSearchValue method needs to be used, as per mentioned documentation.

Best regards, Boris

0 votesVote for this answer Unmark Correct answer

Recent Answers

Brenden Kehren answered on December 19, 2014 18:43

Do you have your parent page setup with the correct tag group in the Properties>General tab of the page?

0 votesVote for this answer Mark as a Correct answer

Cassandra Snyder answered on December 19, 2014 18:49

Yes, the tag group is applied to the root document which is the parent of the results page and the results page is inheriting that setting.

0 votesVote for this answer Mark as a Correct answer

piyush kothari answered on August 30, 2016 17:25

I am having a weird issue, i have added tags to custom document type. On the parent page "BlogFunctions.GetDocumentTags" doesn't display any tags, but on inner pages it does. for ex: on it does not display any tags, but to it displays. Both documents are using same template and media is assigned to tag group and all child pages inherit it.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.