You can create an AEM application that searches the CQ repository for JCR data and displays results to the end user. For example, you can search CQ pages under a specific repository node (for example, nodes under /content) and look for a specific search term. All content that satisfy the search criteria are included in the search results. To search the Adobe CQ repository, you use the JCR Query Object Model (JQOM) API. For information about the API, see Interface QueryObjectModel.
JQOM is an AEM query language that is like ‘prepared statements’ and SQL2 is like ‘statements’ in JDBC queries. For example, a use case may require to retrieve all JCR nodes from ‘Geometrixx’ which has the property pageTitle.
QueryObjectModelFactory qf = currentNode.getSession().getWorkspace().getQueryManager().getQOMFactory();
Selector selector = qf.selector("cq:PageContent", "s");
Constraint constriant = qf.descendantNode("s", "/content/geometrixx");
constriant = qf.and(constriant, qf.propertyExistence("s", "pageTitle"));
QueryObjectModel qm = qf.createQuery(selector, constriant, null, null);
QueryObjectModelFactory gets the instance of the JCR Object Model. The Selector is used to set the type of node that the query needs to look at. Constraint is used to add all the constraints which is like where condition into the query model. Finally a query is created with the selector and constraint that captures the response as aQueryObjectModel.
To read this development article, click https://helpx.adobe.com/experience-manager/using/jqom.html.
JQOM is an AEM query language that is like ‘prepared statements’ and SQL2 is like ‘statements’ in JDBC queries. For example, a use case may require to retrieve all JCR nodes from ‘Geometrixx’ which has the property pageTitle.
QueryObjectModelFactory qf = currentNode.getSession().getWorkspace().getQueryManager().getQOMFactory();
Selector selector = qf.selector("cq:PageContent", "s");
Constraint constriant = qf.descendantNode("s", "/content/geometrixx");
constriant = qf.and(constriant, qf.propertyExistence("s", "pageTitle"));
QueryObjectModel qm = qf.createQuery(selector, constriant, null, null);
QueryObjectModelFactory gets the instance of the JCR Object Model. The Selector is used to set the type of node that the query needs to look at. Constraint is used to add all the constraints which is like where condition into the query model. Finally a query is created with the selector and constraint that captures the response as aQueryObjectModel.
To read this development article, click https://helpx.adobe.com/experience-manager/using/jqom.html.
No comments :
Post a Comment