Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.
SOLVED

Query to find the assets that are missing metadata

Avatar

Level 2

Hello,

Can any one help me with the property/query to find all the assets with missing metadata in a folder path?

Thanks,
Rahul

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Level 4

Hi @RahulMohan ,

Please find the below query for finding the asset which are not having a specified metadata properties.

 

type=dam:Asset
path=/content/dam/your-project-folder-name
1_property.operation:exists
1_property=jcr:content/metadata/dam:ColorSpace
1_property.value:false
p.limit=-1

 

Above query will fetch all the asset which does not have property dam:ColorSpace  as metadata fields.

 

As you have mentioned you want to search for 10 metadata fields you may use group mechanism. Below is just a reference you may modify as per your requirement. Below query checks for three properties(if any of the three not present it will fetch in the result,  you may twist with or / and  as per requirements)

 

type=dam:Asset
path=/content/dam/your-project-folder-name
group.p.or=true
group.1_property.operation:exists
group.1_property=jcr:content/metadata/dam:ColorSpace
group.1_property.value:false
group.2_property.operation:exists
group.2_property=jcr:content/metadata/dam:Fileformat
group.2_property.value:false
group.3_property.operation:exists
group.3_property=jcr:content/metadata/dc:format
group.3_property.value:false
p.limit=-1

 

Hope this help!

Thanks,

View solution in original post

7 Replies

Avatar

Community Advisor

@RahulMohan There are 2 ways to achieve this:

1. Create a metadata export by selecting specific folder. This will generate a CSV file of all assets and their metadata. You can filter out blanks.

2. Or run the following query for your folder path containing the assets:

{
"path": "/content/dam/your-folder-path",
"type": "dam:Asset",
"property.operation": "exists",
"property": "jcr:content/metadata",
"property.value": "false",
"p.limit": "-1",
"p.guessTotal": "true"
}

 

Hope this helps.

Avatar

Employee

Hi ,

If you are looking for assets missing mandatory metadata then :-

I don't think 2 way is correct as when you upload an asset , it extracts embedded metadata in file like dc:title etc , and also some OOTB generated metadata like dam:size , dc:format , dam:sha etc

Screenshot 2024-06-14 at 11.05.36 AM.png

For checking missing mandatory metadata - > you will need to write a custom logic .

Avatar

Level 2

Hi @digarg ,
Thanks for the response. If there is a missing metadata, the card shows a 'Required Metadata Missing' flag in the card view. And this is OOB. Do we know how that works? It should be using some property to determine that. Even if we need to write custom logic, would like to know what should be the best way to do it. We have around 10 mandatory fields in our schema and that's where I'm looking for any property that denotes missing metadata rather than checking all the 10 fields.
Thanks,
Rahul

Avatar

Level 2

Hi @diksha_mishra ,
Thanks for the response. We are aware about the first method. But we are looking for a report we can create and make available to the users to get a list of assets missing metadata in one click or so. I've tried the below query and it is giving all assets in the folder irrespective of the missing metadata or not.
Thanks,
Rahul

Avatar

Correct answer by
Level 4

Hi @RahulMohan ,

Please find the below query for finding the asset which are not having a specified metadata properties.

 

type=dam:Asset
path=/content/dam/your-project-folder-name
1_property.operation:exists
1_property=jcr:content/metadata/dam:ColorSpace
1_property.value:false
p.limit=-1

 

Above query will fetch all the asset which does not have property dam:ColorSpace  as metadata fields.

 

As you have mentioned you want to search for 10 metadata fields you may use group mechanism. Below is just a reference you may modify as per your requirement. Below query checks for three properties(if any of the three not present it will fetch in the result,  you may twist with or / and  as per requirements)

 

type=dam:Asset
path=/content/dam/your-project-folder-name
group.p.or=true
group.1_property.operation:exists
group.1_property=jcr:content/metadata/dam:ColorSpace
group.1_property.value:false
group.2_property.operation:exists
group.2_property=jcr:content/metadata/dam:Fileformat
group.2_property.value:false
group.3_property.operation:exists
group.3_property=jcr:content/metadata/dc:format
group.3_property.value:false
p.limit=-1

 

Hope this help!

Thanks,

Avatar

Level 4

Hi @RahulMohan ,

There can be following two scenario.

  1. Find all images which are missing some property field in the metadata(that property might be custom or added later so some asset might not have those fields(property) in metadata node

For this scenario above reply (in this thread)perfectly match and you can easily fetch the list.

 

      2. Find all the asset with properties fields are present but having empty value (which are not set).

We cannot search for empty property from query builder console so we can write custom java code for query builder and check the length( 0 or empty / blank/ boolean whatever applicable).

However with the help of xPath we can search for empty field

PFA

Example1.

example1.png

Example 2

example2.png

Above results are for asset shown shown below

assetfiless.png

 

Queries:-

/jcr:root/content/dam//*[fn:name()="metadata" and @customproperties= ""]

or 

/jcr:root/content/dam//*[jcr:content/metadata/@customproperties= ""]

or

/jcr:root/content/dam//*[@customproperties= ""]

 

However you can use your project structure path to narrow down the result / query execution time

/jcr:root/content/dam/path-to-projectfolder//*[jcr:content/metadata/@customproperties= ""]

 

Reference:- https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/aem-query-for-property-wit...

 

Avatar

Level 4

Hi @RahulMohan 

please specify if there's any metadata property which you are searching for that you don't want to be available because in general if you don't have metadata node for image then that would cause error(at least in my case).

can you specify then probably i can help you with the exact query for the meantime i am posting a query assuming you are searching for a asset which is having a metadata property dc:title and value is exampleAsset

type=dam:Asset
path=/content/dam
property=jcr:content/metadata/dc:title
property.value=exampleAsset

if you are searching for images which don't have a metadata node that would not make much sense.