Sitecore Faceting-List and Link Type Fields:Part-2

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,
– Checklist
– GroupedDropLink
– MultiList
– TreeList
– TreeListEx
– DropLink
– DropTree
– GeneralLink

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.

Problem Statement

How to display Friendly Name in Search UI for List & Link fields being used for Faceting?

The Approach

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.

Sitecore Faceting Novice Learnings: Part-1

Sitecore 7 and above versions are really powerful in search capabilities, there are lot of things that can be accomplished. Lucene, Solr, ComputedFields, VirtualFields, Buckets and Faceting has made search very easy in Sitecore.

I have intentionally highlighted “Faceting” above as this is what I am going to blog about in this post. This post is about how you can get started with Faceting in Sitecore.

Task Description

Create a facet for News Category that will be displayed and used to filter results on a bucket folder which contains News Articles.

Here I am demonstrating News Articles which are very common to sites other examples where faceting can be implemented are Products, Employees, Customers, Case Studies and many more.

Creating a Facet

In order to get started with faceting the very first step is to define a facet, you can define a facet at “/sitecore/system/Settings/Buckets/Facets

1)      Select Facets-> Right Click and Insert Facet

Create Facet

2)      Provide Name for the facets in our case it would be “News Category”.

Facet Name

3)      Once the facet is created, there are few important fields that needs to be understood,

Field Usage
Field Name This field should have the name of the field in lower case and should match the field name in your sitecore_master_index. Ideally it would be the field name on your News Article template.

Note: If your field name have spaces replace the space with “_” so for e.g News Article template has “News Category” field, then the field name to be specified in facet should be “news_category”

Global Check this field if you want this facet to appear on all your buckets.Note: If your facet is not global and it should appear on a specific bucket only? Refer to section “Non-Global Facets” of this post to achieve this.



4) Now go to your bucket folder and search, custom configured facet will appear.


News Category is a single line text field and “Dealernews” value can be seen faceted in above screen.


Non-Global Facet

In most of the cases we will be creating non-global facets as they should be displayed only on specific Buckets and not all over the other sitecore buckets.

1)      To do so first off all uncheck the “Global Facet” field on your custom facet.

2)      Select the bucket on which you want the facet to be applied, in Content Tab -> Go to Indexing Section and look for “Facets” field. Select required facet.


Below is a code snippet in case if you want to add facets to an item programmatically.

public void AddNewsFacets(ID itemID)
            const string newsCategoryFacet = "{C4788FE1-EF4A-4814-961C-1CF85B9144CA}";
            var item = Sitecore.Context.Database.GetItem(itemID);

            Logger.LogMessage(string.Format("Adding Facets {0}", itemID), this);
            using (new EditContext(item))
                MultilistField fieldfacet = item.Fields["__facets"];
                if (fieldfacet==null)
                //clear the values first if any saved in the field
                item.Fields["__Facets"].Value ="";

               //now add the required facets
            Logger.LogMessage("Adding TOT Facets Complete", this);

Be tuned on more for Sitecore Faceting! Till then Keep Sitecoring and Sharing