Share-n-dipity

SharePoint serendipity is the effect by which one accidentally discovers something fortunate, especially while looking for something else entirely. In this case, it is the occassional musings, observations, and Ouija board readings about the phabulously

Creating Managed Properties in a Site Collection in SharePoint 2013

Creating Managed Properties in a Site Collection in SharePoint 2013

  • Comments 11
  • Likes

There are many cool things about search in SharePoint 2013, and one that I think is really going to help growing search verticals for departments and business units is the ability to create managed properties down to the site collection level.  Managed properties are frequently used in search verticals because they give you a way to define custom attributes associated with your data that you want to use for purposes of filtering, reporting, and/or refining.  In SharePoint 2010 and prior versions of SharePoint there were a couple of limitations with how they were used that made them kind of cumbersome:

  • You could only create them at the Search Service Application (SSA) level
  • It required a full crawl of all your content first to create a crawled property, and then a second full crawl of all your content to create a managed property.  This was tough for many organizations.

 

In SharePoint 2013 we open this up and make it a lot more accessible.  You can still create managed properties at the SSA level, but now you can also augment those with managed properties at the site collection level. The whole process starts out like before, creating a crawled property.  Again, a new feature here is that when you create a site column in SharePoint 2013, it is automatically configured to be a crawled property before you ever do your first crawl.  Very cool!  After that you can add your site column to any list or library and start adding content.

Now to create a new managed property you can go into the Site Settings and then Search Schema in the Site Collection Administration section.  From there you can create a new managed property and map it back to the crawled property.  Now one of the big differences between managed properties created in the site collection versus the SSA is that when you create new managed properties in the site collection they have three limitations you should be aware of:

  • They can only be text
  • They cannot be sortable
  • They cannot be refinable

You are not out of luck though!  Out of the box we ship a bunch of managed properties expressly for this purpose.  If you look in the list of managed properties you will see things like RefinableDate00..19, RefinableDecimal, RefinableDouble…RefinableString100, etc.  So when you need a non-string value, or you need something sortable or refinable you can use one of these properties.  Let me explain how it works by way of example.

You create a new site column called FavoriteColor; it's a Choice column containing Blue, Green and Red and you want to create a new refinable managed property for it.  First you add it to your list or library, and then drop in some content.  Next you're going to go into Site Settings...Search Schema and scroll down until you find RefinableString00, then edit it.  In the alias field type "Favorite Color", and in the Mappings to crawled properties field, add a Mapping to the ows_FavoriteColor crawled property then save your changes.  That looks something like this:

 

Now once that's done we still need to do a full crawl, but wait - there's a new way to do that in SharePoint 2013 as well.  :-) We no longer need to do a full crawl of the entire corpus - instead we can ask for a "full crawl" of just a single site, or even a single list.  In this case you would want to go into your list where you are using your FavoriteColor column and then go into the Site Settings.  If you click on the Advanced Settings link you can scroll down until you find the Reindex document library (or Reindex list if you are using a list).  Click that link to configure the list to be crawled.  Now the next time any kind of crawl kicks off from the SSA - incremental or full - it will populate the managed property and you can start using it in your queries, query rules and display templates.

Hope this helps you get started creating these yourself.

Comments
Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment