Skip to main content
Level 2
Mar 17, 2024 8:53 AM UTC
Solved

How to create an index correctly (AEM6.5)

We have approximately 20000 assets.

There is a custom attribute on the asset ([asset]/jcr: content/metadata/marketing base information/releaseTime).
When using querybuilder.json to query assets, if using @ jcr: content/jcr: lastModified sorting, the speed is fast. If using releaseTime sorting, the query time is 1 minute.
I created an index, but it didn't work, and the query time is still 1 minute.
Is there a problem with my index creation?

anupampat
anupampatAccepted solution
Community Advisor
Mar 17, 2024 10:57 AM UTC

Hi @qingzhou ,

 

On 6.5 you can edit the /oak:index/damAssetLucene node and under aggregates (/oak:index/damAssetLucene/aggregates/dam:Asset) you should include jcr:content/metadata/marketing_base_information/releaseTime node

and then under /oak:index/damAssetLucene/indexRules/dam:Asset/properties, you can add your custom property like 

<releaseTime jcr:primaryType="nt:unstructured" name="jcr:content/metadata/marketing_base_information/releaseTime" boost="{Double}2.0" ordered="{Boolean}true" nodeScopeIndex="{Boolean}true" propertyIndex="{Boolean}true" type="Date" />

But make sure you use the index generator tool - http://oakutils.appspot.com/generate/index

it will give you the exact node structure you need to achieve.

 

Note - On AEM as a cloud, you will have to rename the damAssetLucene to damAssetLucene-8-custom-1 and keep adding for any new addition , refer - https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/operations/indexing#index-names

3 replies

aanchal-sikka
Community Advisor
Community Advisor
Mar 17, 2024 10:55 AM UTC

@qingzhou 

 

Can you please cross-check, if the "releaseTime" has the ordered property like the jcr:LastModified OOTB?

"jcrLastModified": { "jcr:primaryType": "nt:unstructured", "ordered": true, "propertyIndex": true, "name": "jcr:content/jcr:lastModified", "type": "Date" },

Reason: 

  • If the query uses sorting, have an explicit property definition for the sorted property and set ordered to true for it. This allows the results to be ordered as such in the index and save on costly sorting operations at query execution time.

Reference: https://experienceleague.adobe.com/en/docs/experience-manager-65/content/implementing/deploying/practices/best-practices-for-queries-and-indexing#design-considerations

Translate
Aanchal Sikka
anupampat
Community Advisor
anupampatCommunity AdvisorAccepted solution
Community Advisor
Mar 17, 2024 10:57 AM UTC

Hi @qingzhou ,

 

On 6.5 you can edit the /oak:index/damAssetLucene node and under aggregates (/oak:index/damAssetLucene/aggregates/dam:Asset) you should include jcr:content/metadata/marketing_base_information/releaseTime node

and then under /oak:index/damAssetLucene/indexRules/dam:Asset/properties, you can add your custom property like 

<releaseTime jcr:primaryType="nt:unstructured" name="jcr:content/metadata/marketing_base_information/releaseTime" boost="{Double}2.0" ordered="{Boolean}true" nodeScopeIndex="{Boolean}true" propertyIndex="{Boolean}true" type="Date" />

But make sure you use the index generator tool - http://oakutils.appspot.com/generate/index

it will give you the exact node structure you need to achieve.

 

Note - On AEM as a cloud, you will have to rename the damAssetLucene to damAssetLucene-8-custom-1 and keep adding for any new addition , refer - https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/operations/indexing#index-names

Translate
Adobe Employee
Sep 4, 2025 1:59 PM UTC

There is a new tool now, which replaces the old index definition generator: 

https://thomasmueller.github.io/oakTools/

Translate