Someone was asking today about how to create a managed property at the site or site collection level that is refinable and sortable. When you go into Schema Management at the site collection level you may notice that you can create new managed properties, but only simple ones that are based on string and you they have several attributes that you cannot change, such as whether they are sortable or refinable. That is by design in SharePoint 2013; if you need to create new managed properties with those attributes then it can only be done at the Search Service Application level. However, we do ship some “pre-baked” managed properties out of the box to enable this scenario, and in this post I’ll try and explain how you use them.
If you go into the Site Settings and look at the Managed Properties in the Schema, do a search for Refinable in the list of managed properties. What you’ll find is that there are a BUNCH of them, of all different data types. For example RefinableDouble, RefinableString, RefinableDate, RefinableDecimal, and so forth and so on. For each one of these we actually include several properties – for example, RefinableDouble00 through RefinableDouble00 through RefinableDouble09, RefinableDate00 through RefinableDate19, etc. The reason we include these managed properties, and multiple instances of them, is because they are all defined as refinable and sortable, and they map to different data types.
So let’s go back to the scenario we started with – suppose you create a new Choice field in your site collection called FavoriteColor. You want to create a managed property for this field that is both refinable and sortable. The first thing you want to do, as I’ve mentioned many times, is create a Site Column for the field; this will automatically create a crawled property for you. Now in order to use it as a refinable and sortable field, you need to “connect” it with one of the Refinable* properties I mentioned above. In this case, we will use RefinableString00. So to do this connection, I’ll go into Site Settings and click on Schema. Then I’ll type in refinables in the managed property list so I find RefinableString00. If you click on that, you’ll see that it is already mostly configured exactly like I want – refinable and sortable are both true. There’s really only two things I need to do – map my crawled property and give it an alias.
I’m going to give it an alias so I can refer to it using a name that makes sense, rather than RefinableString00. So, in the alias field I type the name I want to refer to this crawled property by, which is “FavoriteColor”. Next, to connect this with the my crawled property I simply click on the Add Mapping button. It brings up a list of all my crawled properties, and from there I can select ows_FavoriteColor, which I got when I added my Site Column (Note: your crawled property names may vary, but you can always find it based on the Title you gave the field). All I need to do now is save my changes and I’m done – I have a sortable and refinable property for my custom schema in my site or site collection, with a friendly name that I can use to refer to it by. Here’s a quick screen shot with all of these values filled in so you can see how it looks.