Highlighted

Query Builder API | AEM Community Discussion

kautuk_sahni

Community Manager

14-08-2020

BlogImage.jpg

Query Builder API by Adobe Docs

Abstract

The functionality of the Asset Share Query Builder is exposed through a Java API and a REST API. This section describes these APIs.

The server-side query builder ( QueryBuilder ) will accept a query description, create and run an XPath query, optionally filter the result set, and also extract facets, if desired.
The query description is simply a set of predicates ( Predicate ). Examples include a full-text predicate, which corresponds to the jcr:contains() function in XPath.
For each predicate type, there is an evaluator component ( PredicateEvaluator ) that knows how to handle that specific predicate for XPath, filtering, and facet extraction. It is very easy to create custom evaluators, which are plugged-in through the OSGi component runtime.

The REST API provides access to exactly the same features through HTTP with responses being sent in JSON.

Sample Queries
These samples are given in Java properties style notation. To use them with the Java API, use a Java HashMap as in the API sample that follows.
For the QueryBuilder JSON Servlet, each example includes a link to your local CQ installation (at the default location, http://localhost:4502 ). Note that you have to log in to your CQ instance before using these links.

Returning all results
The following query will return ten results (or to be precise a maximum of ten), but inform you of the Number of hits: that are actually available:
http://localhost:4502/bin/querybuilder.json?path=/content&1_property=sling:resourceType&1_property.value=foundation/components/text&1_property.operation=like&orderby=path

Read Full Blog

Query Builder API

Q&A

Please use this thread to ask the related questions.

AEM AEMIBlogSeeding Experience Manager