[英]Tridion DynamicContent.Query Searching By Component Template
I'm trying to render all component presentations from the broker database with a certain component template. 我正在尝试使用特定组件模板从代理数据库中呈现所有组件演示文稿。 Here's the query code so far:
这是目前为止的查询代码:
using Tridion.ContentDelivery.DynamicContent;
using Tridion.ContentDelivery.DynamicContent.Query;
ItemTemplateCriteria CTCriteria = new ItemTemplateCriteria(1111);
PublicationCriteria pubCriteria = new PublicationCriteria(10);
AndCriteria finalCriteria = new AndCriteria(pubCriteria, CTCriteria);
Response.Write("<h1>START</h1>");
Query q = new Query();
q.Criteria = finalCriteria;
string[] result = q.ExecuteQuery();
if (result != null && result.Length > 0)
{
foreach (string r in result)
{
Response.Write("<h1>" + r + "</h1>");
}
}
else {
Response.Write("Result is null or 0-length.");
}
Response.Write("<h1>END</h1>");
I keep getting null
results. 我一直得到
null
结果。 I do have dynamic content publishing setup in cd_storage_conf.xml
and a few component presentations published in the Broker database. 我在
cd_storage_conf.xml
有动态内容发布设置,在Broker数据库中发布了一些组件演示。
My understanding from this document is that, I should be able to retrieve related component URIs using this approach. 我从该文档中了解到,我应该能够使用这种方法检索相关的组件URI。
My Questions : 我的问题 :
Query
class correct? Query
类功能的理解是否正确? EDIT : 编辑 :
Additional info: Regarding ItemTemplateCriteria
, I only assumed that this is used for searching records by Component Template. 附加信息:关于
ItemTemplateCriteria
,我只假设它用于按组件模板搜索记录。 I assumed because there is another criteria class called PageTemplateCriteria
. 我假设是因为还有另一个名为
PageTemplateCriteria
标准类。 Please correct me if this assumption is invalid. 如果此假设无效,请更正我。
EDIT : 编辑 :
Additional info: I've inspected the COMPONENTS
, SCHEMA
and TEMPLATES
tables in the broker database but didn't find the published components there. 附加信息:我已经检查了代理数据库中的
COMPONENTS
, SCHEMA
和TEMPLATES
表,但没有在那里找到已发布的组件。 By default rule in the cd_storage_conf.xml
, published content must go to the broker. 默认情况下,在
cd_storage_conf.xml
,发布的内容必须转到代理。 For reference, here's my config: 作为参考,这是我的配置:
<Publication Id="57" defaultStorageId="brokerdb" cached="false">
<Item typeMapping="ComponentPresentation" storageId="brokerdb" cached="false" />
<Item typeMapping="BinaryMeta" cached="true" storageId="brokerdb"/>
<Item typeMapping="BinaryVariant" cached="true" storageId="brokerdb"/>
<Item typeMapping="Binary" storageId="defaultFile" cached="true"/>
<Item typeMapping="ComponentMeta" cached="true" storageId="brokerdb"/>
<Item typeMapping="ComponentPresentationMeta" cached="true" storageId="brokerdb"/>
<Item typeMapping="ItemMeta" cached="true" storageId="brokerdb"/>
<Item typeMapping="LinkInfo" cached="true" storageId="defaultDataFile"/>
<Item typeMapping="DynamicLinkInfo" cached="true" storageId="defaultDataFile"/>
<Item typeMapping="Page" cached="true" storageId="defaultFile"/>
<Item typeMapping="PageMeta" cached="true" storageId="defaultDataFile"/>
<Item typeMapping="Reference" storageId="brokerdb"/>
<Item typeMapping="Schema" storageId="brokerdb"/>
</Publication>
Double check your cd_storage_conf.xml
and database to check the items are stored there. 仔细检查
cd_storage_conf.xml
和数据库以检查项目是否存储在那里。 If your data is going to the file system it will not be query-able. 如果您的数据进入文件系统,则无法查询。
Specifically I think the ComponentPresentationMeta
must be going to the DB for this scenario to work. 具体来说,我认为
ComponentPresentationMeta
必须转到数据库才能使用此方案。
Also check your cd_licenses.xml
file, if it is expired, if it is (even if the cd_storage_conf.xml
is correct), the items will end up on the file system. 还要检查你的
cd_licenses.xml
文件,如果它已经过期,如果是的话(即使cd_storage_conf.xml
是正确的),这些项目最终会在文件系统上。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.