Expand my Community achievements bar.

SOLVED

How to create an index correctly (AEM6.5)

Avatar

Level 1

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?

1 Accepted Solution

Avatar

Correct answer by
Level 4

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/index...

View solution in original post

2 Replies

Avatar

Community Advisor

@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/prac...


Aanchal Sikka

Avatar

Correct answer by
Level 4

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/index...