Share Point 2013 has several out-of-the-box web parts and the most widely of these are Content Query Web Part (CQWP) and the Content Search Web Part (CSWP). These two web parts are used for querying and search crawl indexed data from a share point site.
ContentByQuryWebpat referred as Content Query Web Part (CQWP) is used to display content using query/filter from another site or sub site within the same site collection. With the CQWP, content display as per the requirement, branding and context can be controlled. CQWP results are pulled using query or search directly from the site.
Content Search Web Part (CSWP) is available with SharePoint On-Premise and in Office 365 tenants. CSWP uses search indexing to return faster results using less resources. CQWP and CSWP web parts require publishing feature to be activated.
Let us explore the best situations/scenarios for using each web part.
Content Search Web Part (CSWP)
- When we need to display all items of a type with n a site collection or from a different site collection.
- When we need to deal with a complicated query for instance a certain content type in a certain date range.
- When we need to customize the display of the items.
Content Query Web Part (CQWP)
We can use Content Query Web Part (CQWP) when we want to display a finite list of properties like title, description and image.
Please see the below image for more details on the same.
Pros and Cons
Web Part Behavior | Content Query Web Part (CQWP) | Content Search Web Part (CSWP) |
Query configuration | Easy | You will need to know about certain search features such as managed properties. |
Query across large amounts of content | Limited | yes |
Handle complex queries | Limited | yes |
Scale to handle future content growth | Limited | yes |
Display content from other site collections | No | yes |
Design of query results can be customized | Yes, by using XSLT. | Yes, by using HTML. |
Maintenance cost in a complex site architecture | High | Small |
Narrow down the query results that are displayed in the Web Part | No | Yes, in combination with other search web parts. |