设为首页 收藏本站
查看: 915|回复: 0

[经验分享] Content Query Web Part VS the Content Search Web Part in SharePoint

[复制链接]

尚未签到

发表于 2019-2-4 15:24:14 | 显示全部楼层 |阅读模式
  There are two Web Parts on a SharePoint publishing site that are very similar: the Content Query Web Part (CQWP) and the Content Search Web Part (CSWP). Just by looking at their names, it’s not clear to distinguish the difference between the two.

  In this article, we’ll help you understand how these Web Parts work, and when you should use one Web Part over the other.
Compare the strengths and limitations of the Web Parts
  It’s important that you understand the strengths and limitations of the two Web Parts because if you choose the wrong one, your site could run into performance problems. You can use both Web Parts to show content that is based on a query. In a simplified world, here’s how you can decide between the two:

  •   Use the CQWP when you have a limited amount of content, your query is simple, and you don’t expect your content to grow much in the future.
  •   Use the CSWP in all other scenarios when you want to show content that is based on a query.
  The table below gives a comparison of the two Web Parts:
Web Part behaviorContent Query Web PartContent Search Web PartQuery configurationEasyYou’ll need to know about certain search features such as managed properties.Query across large amounts of contentLimitedYesHandle complex queriesLimitedYesScale to handle future content growthLimitedYesDisplay content from other site collectionsNoYes (see section below)Design of query results can be customizedYes, by using XSLT.Yes, by using HTML.Maintenance cost in a complex site architectureHighSmall (see section below)Narrow down the query results that are displayed in the Web PartNoYes, in combination with the Refinement Web Part.How the Web Parts display content

  You can use both Web Parts to display information that is stored in a subsite. The user experience for content authors and home site visitors is>  Here’s an example of how these Web Parts behave. Example A shows a company that’s using a CQWP to show content from its sales subsite, and example B shows a company that’s using a CSWP to show content from its sales subsite.

Image calloutExample A:
Content Query Web PartExample B:
Content Search Web Part1You author content in a list.You author content in a list.2The list items are immediately stored in a database.At a set time interval, the list items are automatically crawled and added to the search index.3A visitor views the home site. The CQWP automatically issued a query to the database.A visitor views the home site. The CSWP automatically issues a query to the search index.4The database returns a query result and displays it in the CQWP.The search index returns a query result and displays it in the CSWP.Factors that you should to consider
  Because the Web Parts use different technologies, the use cases for when you should choose one Web Part over the other differ. A use case is often more complex than the simple example shown in the previous section. Before you decide which Web Part to use, it’s important that you consider the following:

  •   How much content do I have?
  •   How complex will by query be?
  •   Where’s my content going to be stored?
  •   How much will my content grow over time?
  •   How much will my maintenance costs grow over time?
  We recommend that you address all of these areas as a whole rather than separately.
  Note    If you’re considering moving from a SharePoint on-premises site to a SharePoint Online site, and you are using CQWPs on your SharePoint on-premises site, you could run into a couple of performance issues. In SharePoint Online you won’t be able to scale your tenant to improve performance. Also, the caching functionality behaves differently in SharePoint Online than in SharePoint on-premises.
What can affect the performance of the Content Query Web Part
  In the previous example, if the News list contains less than 5000 items, the performance of the CQWP is likely to be very good. However, if the News list exceeds 5000 items, and the query in the CQWP is complex, the Web Part can run into performance problems. It’s difficult to define exactly what a complex query is, but a Source that goes across all sites in your site collection is more complex than a Source that queries a specific list. Also, if you query uses Additional Filters, the query complexity increases. The query complexity increases depending on the site column types and conditions that you use. Here are some examples:

  •   A query that filters on a site column of type Multiple lines of text is more complex than a query that filters on a site column of type Yes/No.
  •   A filter that uses a contains condition is more complex than a query that uses an is equal to condition.
  •   Multiple Or conditions increases the complexity of the query.

  The performance of the CQWP is also affected by where your content is stored. If your content is stored across several sites, the total amount of list items the Web Part has to process will affect its performance. For example, on your company’s home site, you want to display the latest news items from lists that are maintained in multiple subsites.  Each list contains 1000 items. That means that the CQWP will have to query across 3000 items.

  In this example, if the query is simple, the performance of the CQWP is likely to be good as long as the total amount of items is less than 5000. However, if the query is complex, the CQWP could run into performance problems even when the total amount of items is a few thousand.
  Another important factor that can affect the performance of the CQWP is if your content grows. A solution that works well today might not apply to your future content. If you expect a large increase in the number of sites or amount of content, you should not use the CQWP.
Use the Content Search Web Part to keep maintenance cost down
  You can use both Web Parts to display content based on information from your site navigation. For example, when a visitor goes to a page, the Web Part on that page automatically issues a query that contains information from your site navigation. The search results are displayed in the Web Part. If you don’t have much content and the query is simple, you can use several CQWPs to display your content. However, because you have to maintain each CQWP individually, your maintenance costs can quickly escalate.
  By using the CSWP with managed navigation and a category page, your maintenance costs will stay the same as your content grows. For example, if you add a new navigation category to your content, you can use the same category page to display the content that belongs to the new navigation category. So even though your content is growing, you’ll only need to maintain the same amount of pages.
  In the example below, you can see how four CQWPs can be replaced by one CSWP on a category page.

Use the Content Search Web Part to display content from other site collections
  You can use the CSWP to display content from other site collections. For example, if you want to author content in one site collection and display this content in another site collection, you have to use the CSWP. The CQWP can only display content from one site collection.

When in doubt, choose the Content Search Web Part
  If you’re unsure about which Web Part to use, then the CSWP is probably the best choice in most cases. This Web Part is more flexible than the CQWP and will give you better performance results if you’re planning on expanding your content over time.
  If you decide to use the CQWP, we recommend that you do testing to find out if the Web Part meets your current and future performance and maintenance requirements.
  原文链接:http://office.microsoft.com/en-ca/office365-sharepoint-online-enterprise-help/when-to-use-the-content-query-web-part-or-the-content-search-web-part-in-sharepoint-HA104206662.aspx


运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-671837-1-1.html 上篇帖子: 如何迁移SharePoint 2010至新的站点 下篇帖子: sharepoint 2010 SMTP邮件地配置
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表