Expand my Community achievements bar.

Join us in celebrating the outstanding achievement of our AEM Community Member of the Year!
SOLVED

How to create a Synchronous index in AEMaaCS

Avatar

Level 3

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

 

 

 

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?

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

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

Avatar

Level 3

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?

Avatar

Community Advisor

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



Arun Patidar