Trimion DynamicContent.Query Component Template Search

I am trying to display all component presentations from a broker database using a specific component template. Here's the request code:

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 get null results. I have a dynamic setting for publishing content in cd_storage_conf.xml and several component presentations published in the Broker database.

My understanding from this document is that I should be able to retrieve the appropriate URI components using this approach.

My questions are :

  • Did I understand the capabilities of the Query class correctly?
  • Have I missed anything, configuration, and code?
  • Is there any other way to get broker content by component template?

EDIT

Additional Information: Regarding ItemTemplateCriteria , I assumed that this is used to search for entries by the component template. I suggested that there is another class of criteria called PageTemplateCriteria . Please correct me if this assumption is incorrect.

EDIT

Additional information: I checked the COMPONENTS , SCHEMA and TEMPLATES tables in the broker's database, but did not find any published components there. By default, the rule in cd_storage_conf.xml , the published content should go to the broker. For reference, here is my configuration:

 <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> 
+4
source share
1 answer

Double check your cd_storage_conf.xml and database to verify that items are stored there. If your data goes to the file system, it will not be requested.

In particular, I think that ComponentPresentationMeta should work with the database for this scenario.

Also check the cd_licenses.xml file if it has expired, if it (even if the correct cd_storage_conf.xml correct), the elements will be in the file system.

+5
source

All Articles