16 Mar 2012
03 Jun 2013
Link to this post
Tags and categories are both the same thing in Sitefinity: taxonomies. The only difference between them is one is hierarchical and the other isn't. Both are stored in the same field, and differentiated at display time if I remember right. Which is why you see them coming back this way.
Now, what's MORE interesting to me is that Categories DIDN'T come back as (Collection) as I think it should have here... which implies there is an outbound pipe somewhere actually processing those, which is very interesting...
So anyway, to your issue, we do something similar, although we use tags for a different purpose: filtering. So we actually store tags based on ID, and then have a custom search results widget that accepts a filtering query string parameter to filter results by. But this should be adaptable for your use.
First, you need a custom outbound pipe to process the tags collection:
/// Tag Search Index Outbound Pipe Class.
public class TagSearchIndexOutboundPipe : SearchIndexOutboundPipe
/// Gets the converted items for mapping.
/// <param name="wrapperObject">The wrapper object.</param>
/// <returns>List of IDocuments.</returns>
public override IEnumerable<IDocument> GetConvertedItemsForMapping(WrapperObject wrapperObject)
var tags = wrapperObject.GetProperty("Tags") as IList<Guid>;
if (tags != null)
var newValue = "";
foreach (var tag in tags)
if (newValue != "")
newValue += ",";
newValue += tag;
wrapperObject.SetProperty("Tags", newValue); // Set the new value to Tags property
And then you need to register it. We actually have all this rolled into a module that registers on app start, but I think you can do the same registration in the Global.asax Application_Start:
Note that what this does is make sure that when an index action occurs (publish, reindex, etc.) it takes the "Tags" property (which is a collection) and then builds a comma delimited list of tag IDs, and makes sure THAT is the value that gets indexed for the "Tags" field instead of it incorrectly trying to cast the collection and you just ending up with (Collection).
If you want the actual tag names to appear here, you'll have to do a lookup on each ID and add that name instead.