Expand my Community achievements bar.

Submissions are now open for the 2026 Adobe Experience Maker Awards.

Facet/Category Solr search with AEM

Avatar

Level 1

Hi, 

Anyone worked on the Solr search with AEM
I need help on the below topic:

1.Facet/Categories Search Implementation

- Indexing Categories 

-getting the  search result data basis on the categories

2.Any Performance issue 

 

 

Thanks

 

1 Reply

Avatar

Level 3

Hi @Sanj123 ,

 

There are two steps 

1. Update the search facets with your custom property

2. Create a new custom oak index 

 

/conf/global/settings/dam/search/facets/assets/.content.xml

This is used in AEM’s DAM search console (like /assets.html) to customize the faceted navigation for assets.


🛠 How to Update DAM Search Facets in AEM as a Cloud Service

📍 Location

Facets for the DAM search UI are stored under:

/conf/global/settings/dam/search/facets/assets

This path contains configurations (in .content.xml) that define which facets are shown (e.g., MIME type, tags, last modified) and their behavior.


Example .content.xml

Here's a sample configuration:

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root
    xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
    xmlns:cq="http://www.day.com/jcr/cq/1.0"
    xmlns:jcr="http://www.jcp.org/jcr/1.0"
    jcr:primaryType="nt:unstructured"
    jcr:title="Assets"
    sling:resourceType="dam/gui/search/facetlist"
    facets="[dc:format,cq:tags,jcr:content/metadata/prism:expirationDate]"/>

🧩 Explanation:

  • facets: This is a multi-value property listing the paths or metadata fields to be used as facets.

    • Examples:

      • dc:format: MIME type

      • cq:tags: DAM tags

      • jcr:content/metadata/prism:expirationDate: Custom metadata


Adding Custom Facets

To add a new facet (e.g., jcr:content/metadata/my:customField):

  1. Ensure the metadata is part of your schema:

    • Navigate to Tools > Assets > Metadata Schemas.

    • Edit the schema associated with your asset type and ensure the custom field exists.

  2. Update .content.xml (or use CRX/DE Lite):

    facets="[dc:format,cq:tags,jcr:content/metadata/prism:expirationDate,jcr:content/metadata/my:customField]"
  3. Deploy or Save Changes

    • If you're managing via code, deploy the updated .content.xml.

    • If via CRX/DE, just save the node.

  4. Test in /assets.html UI.

    • You should see the new facet in the left-side filters after a page refresh.


⚠️ Notes

  • Do not use paths that are not indexed or stored. Ensure the custom metadata is saved and indexed.

  • For AEMaaCS, all /conf configurations should be deployed via content packages or Content as Code.

 

To properly support search facets on a custom metadata property in AEM as a Cloud Service (AEMaaCS), you must also create a custom Oak index for performance and functionality—especially for filtering and faceting in the DAM UI or custom searches.


Steps to Create a Custom Index for a Custom Property in AEMaaCS

Let's say your custom property is:

jcr:content/metadata/my:customCategory

📁 1. Project Structure

Place the index definition here:

/apps/<your-project>/oak-index/myCustomCategoryIndex/.content.xml

🧾 2. Sample myCustomCategoryIndex/.content.xml

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root
    xmlns:jcr="http://www.jcp.org/jcr/1.0"
    xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
    xmlns:oak="http://jackrabbit.apache.org/oak/ns/1.0"
    jcr:primaryType="oak:QueryIndexDefinition"
    compatVersion="{Long}2"
    type="lucene"
    async="[async]"
    includedPaths="[/content/dam]"
    indexRules="[dam:Asset]"
    reindex="{Boolean}false"
    name="myCustomCategoryIndex">

    <indexRules jcr:primaryType="nt:unstructured">
        <dam:Asset jcr:primaryType="nt:unstructured">
            <properties jcr:primaryType="nt:unstructured">
                <myCustomCategory jcr:primaryType="nt:unstructured"
                    name="jcr:content/metadata/my:customCategory"
                    propertyIndex="true"
                    ordered="false"
                    analyzed="true"
                    nodeScopeIndex="true"/>
            </properties>
        </dam:Asset>
    </indexRules>
</jcr:root>

📌 3. Key Properties Explained

Attribute Description

includedPathsRestrict indexing to /content/dam (for performance).
indexRulesDefines what node types and properties are indexed.
propertyIndexEnables exact-match indexing.
analyzedEnables full-text search on this property.
nodeScopeIndexIncludes the property in full-text node-level indexing.

🚀 4. Deploy the Index

  1. Include the index under /apps in your AEM Maven module (typically ui.apps).

  2. Define in filter.xml:

    <filter root="/apps/your-project/oak-index/myCustomCategoryIndex"/>
  3. Build and deploy your code via Cloud Manager or direct package install (for dev/test).


🔄 5. Reindex (Only If Needed)

If you're making changes and want to force reindexing:

  • Set reindex="{Boolean}true" temporarily.

  • Deploy and monitor logs for indexing to complete.

  • Then reset reindex to false.


👓 6. Verify

  1. Use the AEM Query Builder Debugger (/libs/cq/search/content/querydebug.html) to test:

    {
      "path": "/content/dam",
      "property": "jcr:content/metadata/my:customCategory",
      "property.value": "ExampleValue"
    }
  2. Or test in the DAM UI (facets should now filter correctly and fast).


Would you like me to generate a complete sample AEM content package structure (filter.xml, content.xml, etc.) that you can directly integrate into your project?