通过Sitecore API查询大量项目
我已阅读以下问题及其可能相关的答案:
我们有一个使用 Sitecore 作为后端构建的大型画廊。树中组织了许多不同的图库页面:
Sitecore->Content->MediaLibrary->Gallery->User->{Photos}->{Photo_State}
其中 Photo_State 已批准、拒绝等
目前,为了从数据库中检索图像,我们在树的“图库”部分使用 GetAncestors()。这可能会从数据库中检索数千个项目,然后使用正常的 .NET 过滤实践对其进行过滤。
我们怎样才能以更有效的方式做到这一点?
我们考虑使用 Sitecore 快速查询 API 来执行此操作,但我目前不明白如何使用它来解决当前的问题。因此,我们的数据库查询是:
- 给我用户的所有照片(已经处理得很好/优化)
- 给我所有与搜索匹配的照片 - 可以使用快速查询通过 @title='%search%' 处理
- 给我前 28 项画廊 - ???我不知道如何使用快速查询来执行此操作
您知道如何通过 Sitecore API 最佳地处理此问题吗?
I have read the following question and its answers which may be related:
Does Sitecore use Fast Query automatically?
We have a large gallery built using Sitecore as a backend. There are number of different gallery pages organized in the tree:
Sitecore->Content->MediaLibrary->Gallery->User->{Photos}->{Photo_State}
Where Photo_State is approved, rejected and so forth
Currently to retrieve the images from the database we use GetAncestors() on the "Gallery" part of the tree. This may retrieve thousands of items from the database which are then filtered down using normal .NET filtering practices.
How can we do this in a more efficient way?
We looked at using the Sitecore Fast Query API to do this but I don't currently understand how we could use this to fix our current problem. So our DB queries are:
- Give me all photos by a user (already handled well/optimally)
- Give me all photos matching a search - could be handled by @title='%search%' using fast query
- Give me the first 28 items in a gallery - ??? I don't know how to do this with Fast Query
Any idea how this could be handled optimally through the Sitecore API?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我同意马克的观点。我认为你应该完全放弃 sitecore 查询并使用 lucene 索引来获取数据。
以下是一些可帮助您入门的资源:
I我已经在每天有数十万页面浏览量的大型网站上使用过它,它非常可靠。
I agree with Mark. I think you should completely ditch the sitecore query and use a lucene index to get the data.
Here are some resources to get you started:
I have used it on big websites with hundred of thousands of page view a day it is pretty solid.
如果您可能有数千个项目,您应该使用 Lucene 索引。高级数据库爬虫可以使这变得非常容易完成。
If you potentially have thousands of items you should use Lucene indexes. The Advanced Database Crawler can make this pretty easy to accomplish.