Expand my Community achievements bar.

SOLVED

Query with subassets

Avatar

Former Community Member

Hello all,

I have a case with a bunch of pdf's and they have sub folders with various years. Within the years are pdf files.

Now on ingestion AEM creates sub assets of each page within the PDF. For my use case I need my query

to just return the pdf file path. How can I get query results that exclude the sub assets?

1 Accepted Solution

Avatar

Correct answer by
Administrator

The Big Red wrote...

smacdonald2008 wrote...

Post a screenshot of the JCR with the PDF files please.

 


Attached is the screen shot of the JCR. I need to get the pdf only in my query while filtering out the subassets.

So in this case I just want query to return AVA12_1999.pdf and filter out the page#.pdf

 

Please have alook at:- http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manage...

// String sql= "SELECT * FROM sling:Folder WHERE jcr:path LIKE '"+path +"/%'  AND NOT jcr:path LIKE '"+path +"/%/%'";

OR

select * from [dam:Asset] where [jcr:path] like '/content/pdf_archives/current_brands/Avantages/%' AND [jcr:path] NOT like '/content/pdf_archives/current_brands/Avantages/%/subassets%'

~kautuk


 



Kautuk Sahni

View solution in original post

5 Replies

Avatar

Level 10

Post a screenshot of the JCR with the PDF files please.

Avatar

Administrator

Hi 

Please have a look at this old Post:- http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manage...

//

For this type of query - i would look at using the JCR SQL/2. You may have better results by specifying JCR SQL search criteria. See:

https://wiki.magnolia-cms.com/display/WIKI/JCR+Query+Cheat+Sheet

http://www.day.com/maven/jcr/2.0/6_Query.html.

http://www.h2database.com/jcr/grammar.html

What I like about JCR SQL is the ability is include and exclude JCR paths. For example:

 String sql= "SELECT * FROM sling:Folder WHERE jcr:path LIKE '"+path +"/%'  AND NOT jcr:path LIKE '"+path +"/%/%'";

You should be able to write methods using JCR SQL to grab all content in the tree that you specified and search through it. 

I hope this will help you.

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

Avatar

Former Community Member

smacdonald2008 wrote...

Post a screenshot of the JCR with the PDF files please.

 


Attached is the screen shot of the JCR. I need to get the pdf only in my query while filtering out the subassets.

So in this case I just want query to return AVA12_1999.pdf and filter out the page#.pdf

Avatar

Employee Advisor
You can try the following- select * from [dam:Asset] where [jcr:path] like '/content/pdf_archives/current_brands/Avantages/%' AND [jcr:path] NOT like '/content/pdf_archives/current_brands/Avantages/%/subassets%'

Avatar

Correct answer by
Administrator

The Big Red wrote...

smacdonald2008 wrote...

Post a screenshot of the JCR with the PDF files please.

 


Attached is the screen shot of the JCR. I need to get the pdf only in my query while filtering out the subassets.

So in this case I just want query to return AVA12_1999.pdf and filter out the page#.pdf

 

Please have alook at:- http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manage...

// String sql= "SELECT * FROM sling:Folder WHERE jcr:path LIKE '"+path +"/%'  AND NOT jcr:path LIKE '"+path +"/%/%'";

OR

select * from [dam:Asset] where [jcr:path] like '/content/pdf_archives/current_brands/Avantages/%' AND [jcr:path] NOT like '/content/pdf_archives/current_brands/Avantages/%/subassets%'

~kautuk


 



Kautuk Sahni