Skip to main content

Cloud

SP2013 Search–Content Type Managed Property in Queries

Not the right effect?

Very short and sweet this time, hopefully will help those who happen on this page for this common issue.
In the Query Builder, you can create a query using using fields or managed properties. A common field that users will use for creating a fielded search is Content Type. However, as you can see below, the out of the box effect for the content type property filter doesn’t quite have the proper effect.
 
2013-03-05_0029

The right stuff:

The change here is quite simple. Change ContentType to ContentTypeId in your query. Since the referenced value is the content type id, changing the managed property to the correct one makes sense. However, you cannot get the content type id value if you try to add ContentTypeId from the property filter menu. You must first add the ContentType and value then change ContentType to ContentTypeId.
SharePoint creates the Content Type hierarchy by concatenating numerical values together to create the content type id. The deeper the child from the parent, generally the longer its content type id is.
2013-03-05_0035

Going the Other Direction

In the example above, using the content type id also brings in child items. If you had a parent content type “Article Page”, and a child content type underneath it, using the above query would return the parent and its children.
To return only the parent, you can use the query ContentType:”Article Page”, which will return only the content type of Article Page. I’m still trying to figure out why someone couldn’t just get rid of the wildcard at the end of the content type id… but perhaps that for another blog.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Follow Us