AEM Assets: Custom Metadata and Search Facets

Ajay Shankar
Activate AEM
Published in
5 min readFeb 16, 2024

This blog post will explore the process of designing and validating a metadata schema for AEM assets and implementing custom search facets using the fields from the customized schema.

Let’s delve into the process of customizing metadata schemas in Adobe Experience Manager (AEM) Assets, which enables users to define additional metadata properties beyond the default set offered by AEM. This functionality allows for the creation of tailored metadata structures to meet specific requirements, thereby enhancing asset management and organization within the AEM Assets environment.

Create Metadata Schema

1. Go to Tools -> Assets -> Metadata Schemas

2. Choose the default schema and copy it to create your custom schema based on the existing one or create a new schema as per the requirement.

3. Name your schema (for the purpose of this article we will use “sample” as the name), then proceed to select it for editing. Since we opted to duplicate from the default schema to create the new customized schema, it will initially contain the default schema’s fields. From there, we have the flexibility to modify existing fields or sections, or introduce new ones according to our requirements.

4. You can now start building the form using field types provided by AEM under Build Form. Place the field, give a meaningful label to it, and map it to a custom property path that will be used for the custom search in the forthcoming sections.

Here, I’ve added custom fields of different types under a new section “Asset Data” and mapped them to custom properties.

5. Choose the new schema “sample” and select apply to your project root folder or any specific folder which requires this schema for asset metadata.

Validate the metadata schema

To validate the applied schema, we can check the properties of any assets within the specified folder where it’s applied, as well as by exporting metadata.

Validate by using properties

Here, I’ve created a new folder “Assets” under my project (You can also check with existing folders in your project) and applied the schema to it as given in the previous step.

Open properties of any asset under the folder with the applied schema, and we will find the custom sections/properties from our metadata schema.

Validate by exporting metadata

Choose the “Assets” folder and click on Export metadata option

Name your CSV file and then click on the “Export” button. Note that you have the option to choose specific fields that you have added; however, for now, let’s keep it at the default setting to include all properties. After your CSV file is prepared, you will receive a notification in the console. Open the console to view this notification and click on “View All”. Select the notification and open it to access the CSV Download option located at the top.

Open the downloaded CSV file in Excel. You will notice that the schema property is exported along with other metadata fields of the asset,

Create custom search facets

Search facets of default AEM search can be added or edited using the search forms available for page, assets, content fragments, etc.

To modify the form, navigate to Tools -> General -> Search Forms. You’ll see a list of forms. For this specific scenario, let’s proceed to open and modify the Assets Admin Search Rail as given below,

We can author the property predicate from provided search predicates in the right column, as we intend to utilize the custom property linked to our assets.

Here, I’ve named a property field as Asset Id and mapped it to the same custom property that I’ve added during schema field mapping. Once you have added your field, click on “Done.”

Use the custom facet to search

Go to the Assets and pick any asset under the folder for which you’ve applied the custom schema in the previous steps. Open properties and update the custom schema property “Asset ID” with value for the required assets and save it.

Now, we have the capability to search for our asset using the default AEM DAM search. Go to Assets, simply click on the search icon and press enter to view the filters on the left side. Locate the Asset ID that we’ve inputted, update it with the relevant value for our asset, and voila! The asset will appear before us.

Summary

In conclusion, the capability of a custom Metadata schema proves invaluable across various use cases, addressing specific properties needed in existing assets as well as for new properties. Moreover, the implementation of custom filters based on the schema enhances accessibility to DAM assets, significantly reducing working time.

Note : The custom metadata schema can be imported to the JCR under /conf/global/settings/dam/adminui-extension and the custom filter can be imported under the path /conf/global/settings/dam/search/facets

When adding these configs via your AEM codebase, ensure that you include the paths in your filter.xml file to ensure the configs are deployed.

Caution : As you add configurations into the codebase, please be aware of the potential risk associated with overwriting configurations that have been previously set through the AEM UI.

References

https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/assets/manage/metadata-schemas.html?lang=en

https://experienceleague.adobe.com/docs/experience-manager-brand-portal/using/search-capabilities/brand-portal-search-facets.html?lang=en

--

--