The <pz:contentQuery> tag performs a content attribute search for content in the Repository Manager, returning an array of Node objects from the Repository Manager. If the useCache attribute is set to true, the results of a content management query will be cached. The tag only has a begin tag and does not have a body or end tag.
Use the following tags in conjunction with <pz:*> tags to access and display the returned content:
<tagName attribute="value" />
max
Optional (String, long) - Limits the maximum number of content nodes returned. If not present, it returns all of the content nodes found.
sortBy
Optional (String) - Use this attribute to sort the retrieved content in ascending or descending order. Enter the content attributes on which you want to sort the content.
However, you can sort content only on content properties that are explicit, meaning the values are stored in their own database column. System properties (see com.bea.content.expression.Search) are explicit by default. But the content properties you create in the WebLogic Administration portal (properties contained within the content "types" you create) are implicit. If you want to sort on those properties, you must make them explicit by doing the following:
Note: You can sort on explicit properties only against a BEA repository. Third-party repositories might behave differently.
Use ASC and DESC to sort retrieved content in ascending or descending order.
Examples:
sortBy=“myproducts ASC”sortBy="cm_modifiedDate DESC" (This is a system attribute that is explicit by default.)
query
Required (String) - The search query to execute based on the query syntax described in Building Content Queries with Expressions.
id
Required (String) - The array variable name that contains the Node objects found. If no content is found, the variable is assigned an empty array (not null) of Node objects.
useCache
Optional (String, Boolean) - Determines whether Nodes are cached. This attribute can have one of two values:
cacheId
Optional (String) - The identifier name used to cache the Node. Internally, the cache is implemented as a Map; this will become the key. If not specified, the id attribute of the tag is used.
cacheTimeout
Optional (String, long) - The time, in milliseconds, for which the cached Node is valid. If more than this amount of time has passed since the Node was cached, the cached Node will be cleared, retrieved, and placed back into the cache.
Use -1 for no-timeout (always use the cached Node). Default = -1.
cacheScope
Optional (String) - Specifies the lifecycle scope of the content cache. Similar to <jsp:useBean>.
Possible values:
This example queries the content management system for an author and prints the title of the author's work.
<pz:contentQuery id="docs" query="author = 'Hemingway'" /> <ul> <es:forEachInArray array="<%=docs%>" id="aDoc"type="com.bea.content.Node"> <li>The document title is: <cm:getProperty id="aDoc" name="Title" conversionType="html" />
</es:forEachInArray> </ul>