Using Content Search In SharePoint 2013

The Content Search Web Part (CSWP) is a new feature in SharePoint 2013. It can be most accurately compared to the Content Query Web Part that we have in previous SharePoint versions. The one striking difference between Content Search and Content Query is that Content Search allows you to query and show information from any site collection. As long as your search is configured to crawl the information it can be pulled into your CSWP!

This blog covers a basic scenario that will show you how easily the CSWP can be configured and ready for use.

Scenario – A research organization is putting together a SharePoint 2013 Community site to enable all of its top scientists to communicate. It would like to have a section on the site that shows all the organization’s scientists in a functional image slider. The problem is that the photos are spread throughout the site collection in different libraries. The one positive is that the organization uses Enterprise Keywords and all the photos have been tagged with the keyword Scientist. (At the end of this blog, I will show how to activate Enterprise Keywords on a library.)

Here are the steps the organization will follow:

1– The first step is to edit my Community site and add my CSWP which can be found in the Content Rollup category.

2– To configure the web part first click anywhere in the web part, then choose the Web Part tab in the ribbon. From that tab click Web Part Properties

3– We first need to setup the query. To do so click Change query from the web part properties box.

4– A Build Your Query dialog box will open. There are four tabs available Basics, Refiners, Settings and Test. From the Basics tab you should see Switch to Advanced Mode in the upper right corner. If you see Switch to Quick Mode click it. We will start this query from the Quick mode.

5– From the Select a query menu I have several options. In this situation I could either choose Items matching a tag (System) or Pictures (System).  I also have the option of just querying documents, items matching a specific content type, popular items, etc.

6– Under Restrict by app I can decide to query the Current Site Collection, Current Site, Specific URL, or I can choose Don’t restrict results by app and query everything that I am currently crawling.

7– If you remember, in my test scenario I am looking for items that have a specific keyword of Scientist. So here I will choose Restrict on this tag: and enter Scientist.

8– You can add additional filters here or Switch to Advanced Mode for even more options. On the right hand side you can see what your query is currently returning to the web part.

9– The Refiners tab will allow you to filter your query even further. Currently, my query is returning any item that has been tagged with the keyword Scientist, but let’s say in my results I am finding that some documents had also been tagged with that keyword. I only want images to display so I can use this tab to add the ContentType of Picture to my refiners.

10– The Settings tab has a few additional options including the use of Query rules and the loading behavior of your query. For this example I will leave everything at the default.

11– The tab Test gives you your final query text for testing purposes. When finished simply click OK at the bottom of the Build Your Query dialog box.

12– The final step is to setup how results will display. From the Web Part Properties box you have the following options (the settings I choose for this solution can be seen in the image below.)

  • Number of items to show
  • Under Display Templates: Control (List, List with Paging or Slideshow)
  • Under Display Templates: Item (determines how the image and text will display, if you are just listing documents “two lines” would be the best option)
  • Under Display Templates: Don’t show anything when there are no results (leave this checked to avoid blank space, especially when using the slideshow control.)

**Note- If you want to get your hands on the code behind these display templates they can be found under Site Settings > Web Designer Galleries > Master pages > Display Templates > Content Web Parts

When your settings are right click OK to close your web part and you’re done!

Joelle began her career as a trainer and instructional designer in the healthcare industry. She was originally introduced to SharePoint 2007 and was tasked with training, adoption and governance. However, like those that have come before her, she just couldn’t stop there. Joelle began using SharePoint’s out of the box capabilities to build solutions for physician groups across the country. Joelle has focused heavily on Workflows, InfoPath, Excel Services and Visio Services. She is based out of Atlanta and was a member of the Atlanta SharePoint User Group. You can find her on Twitter @Joelle_Shmoelle. When she isn’t geeking out about SharePoint she is probably nerding out about SharePoint.


  1. Thanks for the post. Do you know if there is anyway to group results in the content search web part? I see that it uses the Group_Content.js display template, but there doesn’t seem to be anyway to override, or tell it to use a custom group display template.

    • Hello!

      I believe that Group_Content file is controlling something different. My suggestion would be to make a copy of the Control_List.html file and then add in the grouping. You can then upload it back to that folder to be used. Here is more information about display templates – When you upload custom display templates it creates the .js file for you automatically.

      I have not figured out a way to do this out-of-the-box but I will definitely comment here if I do. (You can also use the CQWP if needed to group)

  2. Great post, but I can’t see the part in my webpart catalogue. Enterprise Features is enabled. Any idea what I’ve missed?

  3. Thanks for sharing the information i saw your video in YouTube it was really nice, We do lot of stuff with Content Query WebPart (CQWP) in SharePoint 2010, after i see your video i fell Content Search Web Part (CSWP) more powerfull and helpful.
    Thanks again looking forward for more video from your community 🙂 SharePoint Rocks!!!

  4. Hi,I want to use content search webpart to retrive video from asset library but I tried so much but not able to do that,could you tell me how to do that?

  5. It is actually a great and useful piece off information. I amm happy that you just shared this helpful info with
    us. Please keep us uup tto date like this.

    Thanks for sharing.

  6. Amazing things here. I’m very glawd too peer your article.
    Thanks a lot and I’m hawving a look ahead too touch you.

    Will you please drrop me a e-mail?


Please enter your comment!
Please enter your name here