How to create a Synchronous index in AEMaaCS | Community
Skip to main content
Level 3
October 29, 2024
Solved

How to create a Synchronous index in AEMaaCS

  • October 29, 2024
  • 1 reply
  • 631 views

I have a custom code with a custom query that runs on publish event through a listener, the query doesnt returns correct results the first time it runs because the property that I indexed has not yet been indexed when the query was triggered, it is a race condition. I tried changing my asynchronous index to an asynchronous index and that fixed the problem in my local, however it seems synchronous indexes are not supported in AEMaaCS, see 

https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/implementing/using-cloud-manager/test-results/custom-code-quality-rules#oakpal-indexasync 

 

 

 

Below was my original index and I removed async from it

 

 

<?xml version="1.0" encoding="UTF-8"?> <jcr:root xmlns:oak="http://jackrabbit.apache.org/oak/ns/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" jcr:primaryType="oak:QueryIndexDefinition" async="[async]" compatVersion="{Long}2" includedPaths="[/content/anf,/content/hco,/content/experience-fragments]" queryPaths="[/content/path1,/content/path2,/content/experience-fragments]" type="lucene"> <indexRules jcr:primaryType="nt:unstructured"> <nt:base jcr:primaryType="nt:unstructured"> <properties jcr:primaryType="nt:unstructured"> <urlType jcr:primaryType="nt:unstructured" name="myProperty" propertyIndex="{Boolean}true"/> </properties> </nt:base> </indexRules> </jcr:root>

 

 

 

How do I fix this without using synchronous indexes?

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 @troubleshooter3 
AEMaaCS doe snot support other index than Lucene, and Lucene does not support synchronous due to performance.

https://jackrabbit.apache.org/oak/docs/query/lucene.html#index-definition

 

Asynchronous Indexing

  • Index update is done via a scheduled jobs(AsyncIndexJobUpdate) defined at specific interval. (5 seconds OOB).

1 reply

arunpatidar
Community Advisor
arunpatidarCommunity AdvisorAccepted solution
Community Advisor
October 30, 2024

Hi @troubleshooter3 
AEMaaCS doe snot support other index than Lucene, and Lucene does not support synchronous due to performance.

https://jackrabbit.apache.org/oak/docs/query/lucene.html#index-definition

 

Asynchronous Indexing

  • Index update is done via a scheduled jobs(AsyncIndexJobUpdate) defined at specific interval. (5 seconds OOB).
Arun Patidar
Level 3
October 30, 2024

I agree, but what is a solution for my situation where I need to query as soon as publish event starts, how do I face this race condition?

arunpatidar
Community Advisor
Community Advisor
October 31, 2024

Hi @troubleshooter3 
I think you can't in AEMaaCS, sync is not supported by Lucene index

Arun Patidar