SharePoint Online Search: Add a Refiner for Content Type
This is yet another in the “Things that Make You Go Hmm…” category. If I only had a nickel…
I would think that one of the most common needs on a search results page would be to add a refiner by Content Type. After all, we all have robust, sensical information architectures in place to improve performance in our organizations, right?
When we create a new search results page in a Search Center, we get a few refiners out of the box that look oh-so-promising.
First there’s ContentTypeId. We all know that Microsoft uses big, ugly ids and GUIDs under the covers all the time. Sometimes they translate easily into whatever they represent. This isn’t one of those times.
Well, what about contentclass? That looks sort of almost useful. But it isn’t. Values like STS_ListItem_DocumentLibrary won’t really help anyone.
Oh, I know. Let’s add the ContentType Managed Property. That’s what works almost everywhere else. Well, except here, as the values don’t make sense to humans, as they are things like application/pdf Document or application/vnd.openxmlformats-officedocument.presentationml.pres… Yes, the ellipses are appropriate here. Who know what that means?
Finally, I found a blog post from Henri Merkesdal that retrieved my sanity. There’s a property way down the list called SPContentType that does exactly what we want.
Ahhh. That’s much better. Thanks, Henri!
Marc, as ever you are on the money. The alternatives you meantion wouldn’t be great for users.
I meant to say, no sign at Ingite of hub site and Enterprise: search UI covergence in terms of the overall search experience presented to users ;-(
I created a custom content type and associated with two new lists where I have total 12 records but the content type shows 700 records. What am I doing wrong here?