Monday, April 22, 2013

How to create custom query predicate in CQ

Use Case: Your search has some custom requirement that can not be covered by existing predicate

Pre requisite:

Suppose you want to create a custom predicate to copare and sort case sensitive property.
Your predicate expression will look like

-----Signature -----

path=<Path under which search would be performed>
type=<node type><property name for which case sensitive search needs to be performed>
customcase.fulltext=<Search Text>

You can test these example after deploying code HOST:PORT/libs/cq/search/content/querydebug.html

---- Example 1 (Find all node with subtitle as "MAIL" and do upper case compare) -----

---- Example 2 (find all node and sort by subtitle property) -----

Note: As you can see, Code is not optimal. It is just an example of how you can create your own predicate. Also Example assumes that you know how to import dependencies for this code. Let me know if you have any question.


  1. Hi Yogesh,

    All of yours blogs are very useful.I have a query regarding Restful API in adobe cq. i want to know what is a scope of restful api in adobe cq where it is n use some for info on it..

    thanks in advance

    1. Hello Pankaj,

      You can get more information about REST from From within CQ please refer


  2. Thanks yogesh god bless you :)

  3. Hi , Yogesh Upadhyay

    Your blog displayed on '' Educational Act '' that I followed your blog . I got more tips by this your blog . This blog given us attractive concepted . Obviously , I signatured your blog . Private property management owners must know the top elements of a very successful residence. If you are looking to spend money on property and have your newly obtained residence up for rental, it will pay to understand that property doesn't just start with purchasing a residence but in setting up the economical predicament where you can buy that residence. It is also essential to recognize that there is a lot of perform to be conducted right from the first step when a decision is created to spend money on property to actually purchasing the residence, especially for first-time traders. Having residence is a complicated and a tough company, that is why it is beneficial to make a analysis when shopping for an income residence as well as the techniques on how to avoid problems that can eliminate your financial commitment profits.

    Thank you for your Excellent Blog .

  4. Hi Yogesh, I deployed this component & tried this example1 & getting an error Caused by: java.text.ParseException: Query:
    /jcr:root/content/geometrixx/en//*[fn:upper-case(@jcr:content/(*)subtitle)='MAIL']; expected: )

    I also have set the property under /content/geometrixx/en/company/press/jcr:content subtitle-MAIL. Any idea, BTW i am using AEM6.

  5. Tennis elbow, inflammation of the elbow joint, is usually caused by overstrain of the muscles in the wrist and fingers.
    Daily Trending Guide It is very painful and limits greatly the use of the hand as the pain radiates from the elbow to the outer side of the forearm.
    You can use acupressure to improve the flexibility of the arm. According to Traditional Chinese Medicine most of the acupressure points which relieve tennis elbow are located in the Large Intestine meridian. So a better bowel function is a side effect of this treatment.

  6. Evans played his trump card – i.e., Castle’s multiyear production deal with Paramount – to lure Castle out of the director’s chair,Old School New Body review and into the highly remunerative but largely ceremonial position of producer for Rosemary’s Baby.

    old school new body f4x reviews (Various sources – most notably, the autobiographies of Robert Evans and Roman Polanski, and a documentary featuring commentary by both men and production designer Richard Sylbert
    Steve & Becky Old School New Body review -- indicate that all final decisions regarding budget, casting and locations were made by Evans, not Castle.) With that out of the way, the Paramount chief set his sights on Roman