Share via


Content Search Web Part in SharePoint 2013

 

Overview

Content Search Web Part (CSWP) is similar to Content Query Web Part which has been used so far in SharePoint 2010.  Limitation of Content Query Web part show items that are in the same site collection. The scope of the Content Query Web Part is limited to the site collection that the Web Part is placed in.

Content Search Web Part (CSWP) is the new web part introduced in SharePoint Server 2013 for displaying dynamic content on SharePoint Pages.  It brings together data from across SharePoint into a single view. It also provides various styling options for making the UI rich in look.

Result looks to the user like a list of documents or list items, much in the same way as the web parts which let you display contents of a particular document library.

The Content Search Web Part lets you pull results from across sites to give a more comprehensive set of results

The Results can be customized in two ways

  • Client side using returned results as JSON
  • Server side using custom display templates

 

Architecture

 

Content Search shows contents  in the search index including SharePoint Data sources (content across site collections) and NON SharePoint Data sources (comes from outside of SharePoint as long as it was crawled and placed in the search index provided the user viewing the page has permissions to see the item).

Configure Content Search Web part

There are two main aspects in the configurations

  1. Choose the items to show (formulate a search query that will return those items as results).
  2. Format the items the way you want (use Display Templates to customize how items look).

Configuration steps: Choose the items to Show

Step 1: Click INSERT from the Ribbon, Select the Content Rollup Category and click on Content Search

** **

** **

**  **

Step 2: From the tool pane click on ‘Change query’ button:

 

 

 

 
 

Step 3: Build the query using BASIC (Quick or Advance mode)

** **

 

   

Configuration steps: Format the items the way you want

Search Results can be formatted using HTML and JavaScript instead of XSL: Display templates.

Display templates make it significantly easier to:

  • Specify what managed properties to retrieve from search.
  • Manipulate values   of the retrieved managed properties in JavaScript, as needed.
  • Display the values   in HTML in the browser.

Limitations

  • Content Search Web Part pulls only the indexed items (Lists and libraries having index on)
  • Fresh data can be displayed only after the crawl
  • Data gets updated after the crawl. For Static content, Content Query Web Part should be used

** **