SQL2 query PDF content
What's an example of SQL-2 query for content of a PDF file that was uploaded to DAM?
I've checked all nodes and properties but cannot find property with file's content
Thanks in advance
What's an example of SQL-2 query for content of a PDF file that was uploaded to DAM?
I've checked all nodes and properties but cannot find property with file's content
Thanks in advance
If you really want to use JCR SQL to search AEM DAM, then read this community article:
http://cq-ops.tumblr.com/post/23544023402/how-to-query-cqs-jcr-with-sql-or-xpath
There is a JCR SQL builder tool that you can use. I just tested it and it works:
[img]JCR SQL Builder.png[/img]
The string that tool provides was:
select * from nt:base where jcr:path like '/content/dam/car/%' and contains(*, '%.pdf') order by jcr:score desc
You can test your queries there. Then get them into your Java JCR API App:
String url = "localhost:4502" ;
String aemUrl = "http://"+url +"/crx/server" ;
//Create a connection to the CQ repository running on local host
Repository repository = JcrUtils.getRepository(aemUrl);
//Allocate memory to the List
//Create a Session
javax.jcr.Session session = repository.login( new SimpleCredentials("admin", "admin".toCharArray()));
//Obtain the query manager for the session ...
javax.jcr.query.QueryManager queryManager = session.getWorkspace().getQueryManager();
String sqlStatement = "<Insert query String>";
javax.jcr.query.Query query = queryManager.createQuery(sqlStatement,"JCR-SQL2");
//Execute the query and get the results ...
javax.jcr.query.QueryResult result = query.execute();
//Iterate over the nodes in the results ...
javax.jcr.NodeIterator nodeIter = result.getNodes();
int u = 0;
while ( nodeIter.hasNext() ) {
//Do Something with the Result Set!
}
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.