web app external to CQ - searching for CQ content via QueryBuilder API | Community
Skip to main content
New Participant
October 16, 2015
Solved

web app external to CQ - searching for CQ content via QueryBuilder API

  • October 16, 2015
  • 4 replies
  • 1675 views

I have requirements to build a web application external to CQ that will search for CQ content.

I would like to use the QueryBuilder API.  For the application external to CQ, What jar / how do I get the jar from CQ? From the Felix Console, it looks like I need this jar "/libs/cq/search/install/cq-search-5.4.6.jar" , but not finding it.

Can I use JackRabbit to get my session and then use the QueryBuilder object in an application external to CQ ?

I am also calling the CQ QueryBuilder API via REST calls.  But I would like to do this in backend java code...

Thank You.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by JustinEd3

The QueryBuilder is actually designed to be used over HTTP. If you look at the documentation (http://dev.day.com/docs/en/cq/current/dam/customizing_and_extendingcq5dam/query_builder.html) it shows a variety of HTTP calls you can make.

You cannot run the Java code in an external application for both technical and licensing reasons.

4 replies

JustinEd3Accepted solution
Employee
October 16, 2015

The QueryBuilder is actually designed to be used over HTTP. If you look at the documentation (http://dev.day.com/docs/en/cq/current/dam/customizing_and_extendingcq5dam/query_builder.html) it shows a variety of HTTP calls you can make.

You cannot run the Java code in an external application for both technical and licensing reasons.

New Participant
October 16, 2015

Someone from Adobe can correct me if I am wrong, but I don't believe the Server Side part of the query builder API is designed to be used remotely. 

If it is though you'll need more than just the cq-search bundle - you need all the a lot of the CRX jars. You first have to make a remote repository connection in order to do a server side search. If you want to go down this path I'd recommend going taking a look at the CRX documentation (http://dev.day.com/docs/en/crx/current.html) with a focus on the two remoting options for access (http://dev.day.com/docs/en/crx/current/developing/accessing_the_crx.html#Accessing the JCR API). 

New Participant
October 16, 2015

getting the remote repository connection looks to be easy via the JCR API:

            Repository repository = JcrUtils.getRepository("http://localhost:7800/crx/server");                                                                       
            //Create a Session instance
            javax.jcr.Session session = repository.login( new SimpleCredentials("admin", "admin".toCharArray()));

            .....

            .....

            session.save();
            session.logout();           

 

That said, I would like to know if I can / how to use the query builder API via my remote repo connection ?

Or would I have to make HTTP RESTful calls to use the QueryBuilder API remote / external to CQ ?

The requirement is for a external web application to be integrated into CQ (search for CQ content).

New Participant
October 16, 2015

You can use the QueryAPI from an external source/application. Scott has written a really cool dev article on how to create a Swing Client that queries the repo. The QueryAPI is actually not Adobe but JCR.

Take a look at http://helpx.adobe.com/experience-manager/using/java-swing-applications.html

/Ove