SharePoint 2013 Search by Content Type Using Query Builder

Super quick blog post for you guys today.

As I dive a little deeper into SharePoint 2013 search and search navigation functionality (which is pretty cool by the way) I ran into a little bug in the Query Builder when trying to create a Search Result by Content Type.  

image

In Office 365 (have not tested On Prem) if you create a Search Source, and launch the Query Builder, then proceed to create a Property filter where ContentType Equals a specific content type. The Query text generated is something like:

ContentType={content type id}

If you then click on the button to Test the query you will not get any results.

image

Hmmm… how can this be? I know I have some Tasks out there. The Query Builder created this Query text for me so it MUST be accurate? Right? I did couple of quick searches and failed to enter the magic keywords to get the result I needed. I would like to say that I played around until I figured it out, but I took the easy way out and asked to see if anyone else had seen this issue before. My friend Stephanie Donahue (@StephKDonahue) told me that I needed to change the Query text to one of the following:

ContentType={content type NAME}

or

ContentTypeId:{content type ID}

Testing the query again gives us the results we are looking for!

image

I may not have run into this issue had I started down the path of searching for a Content Type without using the Query Builder, In retrospect it makes sense why I was not getting results. However, if you are like me and expect that the tool is working and it’s YOU who made the mistake, hopefully this quick tip will get your past your hurdle and on your way to your next task for the day.

Cheers!

Families in Germany who are facing divers soundness problem, such persons can buy drugs from the Web without prescription. With the market flooded with divers web-sites selling sundry medicaments, purchasing medicines from th WEB is no longer a trouble for common man. Certain medications are used to treat infections caused by dental abscesses. Of course it isn’t all. If you’re concerned about erectile health problem, you probably know about Xenical and Hoodia. Probably each adult knows about Garcinia. (Read more PhentermineXenical). The symptoms of sexual heartiness problems in men include improbability to have an hard-on sufficient for sexual functioning. Certain medications may add to sex drive difficulties, so its substantial to cooperate with your health care professional so that the prescription can be tailored to your needs. Preparatory to taking Levitra or other preparation, speak to your dispenser if you have any allergies. Talk to your soundness care purveyor for more details. Preparatory to ordering this remedy, tell your doc if you are allergic to anything.

4 Comments

  1. Hi,
    I have recentely started working with a customer that has an updated SharePoint environment from SP2010 to SP2013( Server Enterprine). In this environment whenever i try to use built in Query builder in Serach Results Web Part (or another search related web part) and hit test It keeps on showing loading image and shows nothing under Relevant Results. Although when i hit Apply, results display properly. I have try to debug this issue in IE that shows “Object doesn’t support property or method ‘set_timeZoneId'” for Search.Configuration.QueryBuilder.get_$9().get_dataProvider().set_timeZoneId(Search.Configuration.QueryBuilder.$0.TimeZoneId). There is nothing much helpful specific to this Issue.
    Any help would be highly appriciated

Comments are closed.