gpt4 book ai didi

sitecore - Sitecore 会自动使用快速查询吗?

转载 作者:行者123 更新时间:2023-12-04 10:44:06 29 4
gpt4 key购买 nike

根据 Sitecore 数据定义引用,版本 6.4,第 4.3.1 节:

Sitecore processes queries using the fasted technology possible. This could be either the SQL database, if the data provider supports the requested query, or in the Sitecore data manager.



如果是这样,使用“fast:”语法有什么好处吗?在哪个版本中引入了自动技术选择?

更新
我想我想通了。规则 Sitecore 查询只有在没有谓词的情况下才能使用 SQL Server。快速查询允许简单的谓词(例如 *[@somefield='somevalue']),同时仍然使用 SQL Server。

来自 Sitecore CMS 6.4 数据定义引用(第 4.3.4 节):

The SQL Server data provider does not support predicates (the portion of the search string enclosed in square brackets: [@IsHidden != '1']).



来自 Sitecore CMS 6 使用 Sitecore 快速查询(第 4.2 节):

This section describes the predicates that are available in Sitecore Fast Query. Predicates are always embedded in square brackets.


Example: fast:/sitecore/content/Home/*[@Title = 'Welcome to Sitecore']  

Result: returns the items that have the value of the 'Title' field set to 'Welcome to Sitecore'. The search is performed in the children of the Home Item.

最佳答案

有几种不同的方法可以从 Sitecore 查询项目:

  • Sitecore 查询
  • 快速查询
  • Lucene

  • 每种方法都有其优点和缺点。例如,Sitecore Query 和 Fast Query 对它们可以返回的项目数量都有限制。此限制是 Query.MaxItems web.config 中的设置.另一方面,Lucene 是它自己的野兽,它使用存储在磁盘上的搜索索引来访问项目。

    Sitecore 查询在过滤查询中的项目方面是最灵活的,但是您的查询越复杂,运行所需的时间就越长(这是一种概括)。通常更容易创建更通用的查询,然后使用 .NET 对其进行过滤,例如 LINQ。快速查询直接到数据库查询,因此对过滤有限制。它运行得更快,但您无法详细了解要在查询中检查的内容。

    Lucene 是另一种方法,因为它使用搜索索引来查询内容和过滤。这需要预先进行额外的配置工作并维护搜索索引。

    这可以帮助您决定采取哪种方法:
  • 100 件或更少:Sitecore 查询
  • 1000 项或更少:快速查询
  • 1000+ 项:Lucene

  • 我之前也写过关于同一主题的博客文章:
  • Options For Querying Items From Sitecore
  • 关于sitecore - Sitecore 会自动使用快速查询吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5846294/

    29 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com