AEK OAK Indexes in CodeBase | Community
Skip to main content
Level 3
April 12, 2024
Solved

AEK OAK Indexes in CodeBase

  • April 12, 2024
  • 7 replies
  • 1542 views

Hi Team,

 

Is there any way to address below issue:

 

We need to make our custom oak indexes as part of code base and property  "reindex" value is true. In this case after every code deploy, all indexes will run.

PROBLEM: How to make sure after every code deploy, these indexes do not run?

Is there any way to do it in more better way?

 

Regards,

KTNR

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by arunpatidar

Hi @arvindpandey 
Are you AMS or AEMaaCS ?

AEMaaCS run reindexing before deploying the code.This deployment initiates two jobs, responsible for adding (and merging if necessary) the index definitions to MongoDB and Azure Segment Store for author and publish, respectively. Prior to the switch, the underlying repositories undergo reindexing with the updated index definitions.

 

Please check https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/operations/indexing 

 

However you can deploy index from code on AMS/On-Prem/AEMaaCS from code base

7 replies

ksh_ingole7
Community Advisor
Community Advisor
April 12, 2024

Hi @arvindpandey

 

Refer this document to add oak:index using the code. jackrabbit - How to create oak:index in AEM programatically - Stack Overflow

 

Thanks

arunpatidar
Community Advisor
arunpatidarCommunity AdvisorAccepted solution
Community Advisor
April 12, 2024

Hi @arvindpandey 
Are you AMS or AEMaaCS ?

AEMaaCS run reindexing before deploying the code.This deployment initiates two jobs, responsible for adding (and merging if necessary) the index definitions to MongoDB and Azure Segment Store for author and publish, respectively. Prior to the switch, the underlying repositories undergo reindexing with the updated index definitions.

 

Please check https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/operations/indexing 

 

However you can deploy index from code on AMS/On-Prem/AEMaaCS from code base

Arun Patidar
Shashi_Mulugu
Community Advisor
Community Advisor
April 13, 2024

@arvindpandey can you please explain why you need to have reindex true property in codebase?

partyush
Community Advisor
Community Advisor
April 13, 2024

Hi @arvindpandey 

Absolutely, there are ways to address the issue of automatic reindexing after every code deployment with "reindex" set to true. Here are two approaches:

 

Use a Flag File:

  • Introduce a flag file within your codebase (e.g., a text file named oak_indexes_reindexed.flag).
  • During deployment, check for the existence of this flag file.
  • If the flag file doesn't exist, set the "reindex" property to true for your custom oak indexes and trigger the reindexing process.
  • Once reindexing is complete, create the flag file to indicate successful reindexing.
  • On subsequent deployments, if the flag file exists, skip setting "reindex" to true, thereby avoiding reindexing.

Also, there is another way to do the same : 

 

  • Set "reindex" to false by default: This avoids unnecessary reindexing after every deployment.
  • Implement a mechanism to trigger reindexing manually or programmatically: This could be a script or functionality within your application that allows reindexing on demand when necessary (e.g., after significant data model changes).

Thanks

joerghoh
Adobe Employee
Adobe Employee
April 14, 2024

If you are using AEM 6.x (and not AEM CS), you can use the Ensure Oak Index feature of ACS AEM Commons.

EstebanBustamante
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
April 18, 2024

@arvindpandey Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.

Esteban Bustamante
chaudharynick
Level 4
April 25, 2024

Hi @arvindpandey 

 

reindex property should not be present in the repo for deploying.

 

May i know what AEM version are you using and specific reason for having this property in repo