Content Types is an important asset many organizations don’t pay enough attention to. This feature is available both on-prem and in the cloud, and besides its generic usability benefits, it helps content findability, too. In this blog post, I’m going to focus on two benefits:
The environment – quick overview
My demo environment is in SharePoint Online (Office 365), and consists of several sites. Each site has one or more document libraries where I store the demo content.
I also set up a Content Type HUB where I’ve created a demo content type with the name: SE Contract.
I use this content type in two document libraries, on two different sites.
List documents by content type
In the default Search Schema, there’s a Managed Property called ContentType. You can use this managed property to filter the results by on your pages. For example, let’s create a web part that displays every document with the content type of “SE Contract”.
To do so, edit the page where the list of the documents has to be displayed, and add a Content Search (or Search Results) web part. In the web part’s properties click on “Change Query” and use this query instead of the default one:
After changing the query, you can also change the Display Template being used. Save the page and enjoy! It’s your first search-driven page:
Use Content Type as Search Refiner
You get the idea: since Content Type is a metadata in the Search Schema, let’s use it as a refiner!
Is it possible? – Of course, it is! ContentType is refinable, therefore you can add it to your refinement panel, no problem.
Let’s do this! See this post for the detailed steps.
However, when you save your settings, you can see that the values displayed here are not really user friendly:
If you’re familiar with the concept of Managed Properties in Search Schema, you know that the solution might be somewhere around the mapping of this Managed Property.
Usually, there are several options:
Change the mapping of the managed property (NEVER do this with an out-of-the-box Managed Property!!)
Create a new Managed Property with the proper mapping(s)
Use another Managed Property.
To be able to decide if there’s an existing Managed Property that we can use let’s do a search in the Search Schema. You’ll find there’s one more Managed Property we can use: SPContentType.
To check the values of a Managed Property, I recommend to use the SharePoint Search Query Tool.
For SPContentType, you’ll see it has the user friendly values we need. Let’s add this to our Search page as a refiner:
Also, as you can see on the screenshot above, if you create refinable Managed Properties, the custom columns used on your Content Type can be also used as refiners (Customer Name, Contract Date, etc.).
Leave a Reply