I'm trying to create Lucene Indexes on Apache Geode Region.
I have all the Region definitions in cache.xml
. This cache.xml
is read by cache server and Regions are created.
If I define a Region something like below in cache.xml
,
<region name="trackRegion" refid="PARTITION_PERSISTENT">
<lucene:index name="myIndex">
<lucene:field name="tenant" />
</lucene:index>
</region>
Region is created with Lucene Index, but it doesn't allow me to add other properties of Region like, indexing on primary key, Region compressor etc.
Geode says we should create the Lucene Index first then Region should be created. How should I define the Lucene Index for a Region like below.
<region name="trackRegion" refid="PARTITION_PERSISTENT">
<region-attributes>
<compressor>
<class-name>org.apache.geode.compression.SnappyCompressor</class-name>
</compressor>
</region-attributes>
<index name="trackRegionKeyIndex" from-clause="/trackRegion" expression="key" key-index="true"/>
</region>
Also, I tried creating the Region with Java annotations following this document, https://github.com/spring-projects/spring-data-gemfire/blob/main/src/main/asciidoc/reference/lucene.adoc#annotation-configuration-support.
Even with this I get The Lucene Index must be created before Region error.