Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

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

Avatar

Level 2

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.

1 Accepted Solution

Avatar

Correct answer by
Employee

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.

View solution in original post

4 Replies

Avatar

Correct answer by
Employee

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.

Avatar

Level 8

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). 

Avatar

Level 2

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).

Avatar

Level 6

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