A second post in the series on Sitecore Faceting, the first post, Sitecore Faceting Novice Learnings was about getting stated with Sitecore Faceting, if you have missed it check it here. This post is about a Sitecore Setting that comes in handy when faceting for List or Link Type fields needs to be implemented.
Are you faceting List (MultiList, TreeList and others) and Link (General Link, DropLink and others) Type Fields and wanted to display the search results on a bucket, faceted by any of these fields? These fields internally stores ID of the referenced item, so if you facet on them you will see IDs being displayed on the search UI.
Below is the list of fields that stores ID of the referenced item in index,
Note: DropList and GroupedDropList stores the name of the referenced item in an index so we do not need to worry about them while faceting.
Below screenshot displays how by default the Search UI displays IDs while faceting List and Link Type fields.
Sneaking over the indexes via Luke will also show that the indexes stores the ID of the item and hence it displays the same on the Search UI.
Content authors will surely come complaining to a developer that they will be happy if they see the actual name (friendly name) of the item being faceted instead of ID.
Sitecore has a lot of settings which allows you to tweak things and configure sitecore your way. I would like to share about a gem (so called setting) for Faceting in this post.
How to display Friendly Name in Search UI for List & Link fields being used for Faceting?
In order to solve above problem I started with googling and the hits that made me interested were,
– Sitecore 7 Content Search – Custom Facets on List Fields by Glen McInnis, after going through this article it was not going to help me as it was SOLR and I needed something for Lucene.
– FACETS EXPLAINED by Sitecore 7 Development Team, this too didn’t worked for me as these were the steps I already did and the Search UI was displaying IDs for me on the bucket folder for the facets.
– SITECORE 7: MAKING GOOGLE PART 2 by Sitecore 7 Development Team, this post seemed promising to me and made me think I would have to define a virtual field and do customization. But this was a lot to do.
It constantly made me think that there should be a simpler way to achieve this hence I discussed with few brilliant brains around me (Kiran Patil and Bhavesh Maniya) who I thought might have worked on faceting. This too didn’t helped me as these guys didn’t worked on faceting for List or Link Type fields.
Brilliant brains have brilliant ideas, Kiran suggested me to look at the sitecore support portal and check if there is a ticket for it. This was a bull’s-eye for me and I found my solution. Marcia Dietrich one of our colleague already had the same problem and was answered to her query by Sitecore Support Team.
The Simplest Solution
So here come the curtain raiser, below setting is used for displaying item name for a list field being faceted on the Search UI.
The comments above this setting does mentions that if you have huge data this might degrade performance so use it wisely.
Setting the value of “BucketConfiguration.ResolveFacetValueToFriendlyName” to “true” in \App_Config\Include\Sitecore.Buckets.config would change the IDs to friendly name and you would have now become a magician for your content authors
I am just warming up myself to write the third one in this series of sitecore faceting. If you find it interesting or want to share more about faceting please do comment on this post.