In SharePoint 2007, there was a very slick feature called “Faceted Search” which allowed you to filter your search results set based on different properties of the content. This concept is nothing new, you have probably seen this functionality on popular search websites like Bing, and then some time after, Google. For example you can do a search for “Australian Open”. This is a very broad type of query, so what the search engine does is present you with refiners on the left hand side. You may be looking for “News” or “Images” or “Videos” or even “Shopping” related to Australian Open. However in SharePoint 2007, if you wanted to get this functionality it was not out of the box. You had to download a Codeplex feature that enabled it, which also did not have the most streamlined installation process (custom databases, web.config modifications, etc…) Thankfully this functionality is now baked into the SharePoint 2010 product, and is even more enhanced if you are running FAST Search for SharePoint 2010.
Having this functionality come out of the box is excellent, however one of the best aspects is that it is customizable. For example when I do a search for “Neil” I get the Result Types refiner:
This is one of the most useful refiners because you can filter on Word/Excel/PowerPoint documents, which is why it is the first Refiner at the top of the Panel. However this should not be confused with “Content Type”. In order to get Content Type into your refinement panel you will have to follow a few steps. First you have to go to the FAST Search Administration page and click on Managed Properties:
Next you will need to create a new Managed Property for Content Type. Now while there already is a ContentType property out of the box, I usually like to create my own. The reason being is that the built in one has a hold bunch of crawled properties which I usually don’t need such as mime(Text) and Basic:5(Text). In plain English, these crawled properties look at built in metadata from Office Documents and while useful, to me I like to just limit my property to the SharePoint Content Type which is ows_ContentType(Text). So what I do is create a new one called SPContentType:
Make sure to check off both “Refiner Property” and “Deep Refiner”. Deep Refiners take up more memory but will give you accurate counts in your refinement panel, without which in my opinion make the whole thing pretty useless. After doing this you will need to run a full crawl of your content. The last step is to modify your Refinement Panel Web Part in your search center. Go to the search results page and hit edit, and then edit the web part:
This will display the Web Part Properties on the right side of the page. The section you’ll be interested in is “Refinement”. MAKE SURE to uncheck the “Use Default Configuration” checkbox and then edit the Filter Category Definition:
You can edit it inline, or if you have a good XML edit you can use that (I prefer Visual Studio). Then add the following entry for the Content Type Refiner to the XML Body:
You can paste it into the place where you want it to appear in your Refinement panel, in my case it’s the third down:
Then Voila! After you save your XML and do a search result you will now have your own custom Content Type Refiner in your search results page. Enjoy!