Using Content Search Web Part instead of Content Query Web Part to improve performance in SharePoint Online

 

마지막으로 수정된 항목: 2014-12-08

Summary: Describes how to increase performance by replacing the Content Query Web Part with the Content Search Web Part in SharePoint 2013 and SharePoint Online.

One of the most powerful new features of SharePoint 2013 and SharePoint Online is the Content Search Web Part (CSWP). This Web Part uses the search index to quickly retrieve results which are shown to the user. Use the Content Search Web Part instead of the Content Query Web Part (CQWP) in your pages to improve performance for your users.

Using a Content Search Web Part over a Content Query Web Part will almost always result in significantly better page load performance on SharePoint Online. There is a little additional configuration to get the right query, but the rewards are improved performance and happier users.

The following examples show the relative performance gains you may receive when you use a Content Search Web Part instead of a Content Query Web Part. The effects are more obvious with a complex site structure and very broad content queries.

This example site has the following characteristics:

  • 8 levels of subsites.

  • Lists using a custom "fruit" content type.

  • In the Web Part, the content query is broad, returning all items with the content type of “fruit”.

  • The example only uses 50 items across the 8 sites. The effects will be even more pronounced for sites with more content.

Here is a screen shot of the results of the Content Query Web Part.

웹 파트에 대한 콘텐츠 쿼리를 보여 주는 그래픽

In Internet Explorer, use the Network tab of the F12 developer tools to look at the details for the response header. In the following screen shot, the value for the SPRequestDuration for this page load is 924 milliseconds.

924의 요청 기간을 보여 주는 스크린샷

SPRequestDuration indicates the amount of work that is done on the server to prepare the page. Switching Content by Query Web Parts with Content by Search Web Parts dramatically reduces the time it takes to render the page. By contrast, a page with an equivalent Content Search Web Part, returning the same number of results has an SPRequestDuration value of 106 milliseconds as shown in this screen shot:

106의 요청 기간을 보여 주는 스크린샷

Adding a Content Search Web Part is very similar to a regular Content Query Web Part. See the section "Add a Content Search Web Part" in Configure a Content Search Web Part in SharePoint.

Once you have added a Content Search Web Part, you can refine the search and return the items you want. For detailed instructions on how to do this, see the section, "Display content by configuring an advanced query in a Content Search Web Part" in Configure a Content Search Web Part in SharePoint.

For a tool to build and test complex queries, see the Search Query Tool on Codeplex.

 
표시: