我们使用以下代码通过快速查询获取 Sitecore 项目:
db.SelectItems("/sitecore/content/test//*[@@templatename='test template name']");
但是这段代码的问题在于它从所有语言版本中获取项目。
有没有办法可以传递语言参数以进行快速查询,或者如何使用快速查询获取指定语言版本的项目?
提前致谢。
最佳答案
引用约翰·韦斯特的话:
Fast query does not account for the context language (results include items with versions that match the query in any language)
更多信息可以在这里找到:Sitecore Query Cheat Sheet .
所以答案是:不,你不能将语言传递给快速查询。
考虑切换到 Sitecore 内容搜索。直接对 SQL Server 数据库执行快速查询。它没有规模。如果过度使用,它甚至可以杀死您的网站。
关于sitecore - 我们如何使用快速查询检索特定语言的站点核心项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44281490/