Render content in SharePoint with content query and content search

By - November 4, 2015

Within SharePoint 2013, there are two different ways you are able to render the content from your SharePoint sites. You can render content with content query using Content Query Web Part (CQWP) or with content search using Content Search Web Part (CSWP) or Search Results Web Part (SRWP).

CQWP helps with the retrieving and viewing the content in a real-time query. CSWP or SRWP help with retrieving and viewing the content based on the search results. Continuous crawls crawl SharePoint sites frequently to help keep search results fresh and enables the rendering of the content using content search.

The content query is limited to the site collection where CQWP was added. The content search does not have this limit. Another difference is that CQWP leverages XSLT to format the content on the page and the CSWP and SRWP leverages display templates. A display template is structured using standard HTML, JavaScript and a CSS. A power user can be trained easily to create and maintain display templates or create new ones but XSLT requires a developer for creating and maintaining.

Both CSWP and SRWP can be very useful in retrieving and displaying the content. There are out of box display templates which are used by both of these web parts to format the content in the site. However, there are several use cases where the content format must be customized for usability and adoption.

Below I have highlighted the difference between CSWP and SRWP:

CSWP SRWP
Query Builder to retrieve the required content Query Builder to retrieve the required content
Display Templates to format the content on the page Display Templates to format the content on the page
Available on SharePoint 2013 Enterprise edition only Available on all SharePoint 2013 editions
All managed properties under search service available as a dropdown to be included in the query Manual editing of the display template to choose the managed propery available

Also, I have included an example of SRWP with an out of box display template known as a, “common item body.” (Please note that the default title is in blue for populating search results.)

SRWP-1

If you want to customize the search results title and have it appear in red, you have the ability to make a the change in the, “common item body,” display template as well.

SRWP-2

In part two of my post, I will will show you how to create and customize a display template that can be leveraged by CSWP or SRWP. To find out more about this or other ways that RSM can assist you with your SharePoint needs, contact our professionals at 800.274.3978 or email us.

 

Comments

Leave a Reply

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

Receive Posts by Email

Subscribe to the IT Infrastructure blog and receive notifications of new posts by email.