How to create a Synchronous index in AEMaaCS
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
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?