Expand my Community achievements bar.

SOLVED

AEM 6.4.1.0 : Retrieve dam assets based on certain properties via querybuilder

Avatar

Level 8

The query tried is as below :

In http://localhost:4502/libs/cq/search/content/querydebug.html, they work fine. Even in crxde query options they work fine. Via code, when exceuted , doesnt work. Index related errors seen in logs. Created custom indexes as well and getting picked up as well, but that doesn't seem to be the problem.

The issue seems to be the way in which querybuilder predicates[mentioned in #1 and #2 below] are being tried.

property2 to property7. All of them are different properties present under metadata.

#1]

type=dam:Asset

path=/content/dam/xxx

orderby=@jcr:content/jcr:lastModified

orderby.sort=desc

group.2_group.property=jcr:content/metadata/dita_class

group.2_group.property.value=- map/map

group.1_group.p.or=true

group.1_group.1_property=jcr:content/metadata/property2

group.1_group.1_property.value=admin[logged in user]

group.1_group.2_property=jcr:content/metadata/property3

group.1_group.2_property.value=admin[logged in user]

group.1_group.3_property=jcr:content/metadata/property4

group.1_group.3_property.value=admin[logged in user]

group.1_group.4_property=jcr:content/metadata/property5

group.1_group.4_property.value=admin[logged in user]

group.1_group.5_property=jcr:content/metadata/property6

group.1_group.5_property.value=admin[logged in user]

group.1_group.6_property=jcr:content/metadata/property7

group.1_group.6_property.value=admin[logged in user]

location=asset

location.suggestion=Assets

#2]

type=dam:Asset

path=/content/dam/xxx

orderby=@jcr:content/jcr:lastModified

orderby.sort=desc

property=jcr:content/metadata/dita_class

property.value=- map/map

group.p.or=true

group.1_property=jcr:content/metadata/property2

group.1_property.value=admin

group.2_property=jcr:content/metadata/property3

group.2_property.value=admin

group.3_property=jcr:content/metadata/property4

group.3_property.value=admin

group.4_property=jcr:content/metadata/property5

group.4_property.value=admin

group.5_property=jcr:content/metadata/property6

group.5_property.value=admin

group.6_property=jcr:content/metadata/property7

group.6_property.value=admin

location=asset

location.suggestion=Assets

Any thoughts/pointers/reference code on this will be really helpful.

1 Accepted Solution

Avatar

Correct answer by
Level 8
4 Replies

Avatar

Community Advisor

In this which is the query you want to execute ? Both have different grouping logic right ?

Avatar

Level 8

#1 and #2 were variations I was trying out at my end, to achieve the end result. Probably I was not too clear.

Basically the motive is to list all assets having a specific property present as part of "jcr:content/metadata/dita_class" property and look for logged-in user value in any of the 6 metadata properties.

Avatar

Level 9

simply do like this:

path=/content/dam/xxx

1_property=dita_class

1_value=map

2_property=tiff:ImageLength

2_value=600

Avatar

Correct answer by
Level 8