Omar-Alfred Salah
Omar-Alfred Salah

Reputation: 57

Hazelcast - Indexing on object field / property

I was wondering whether this was possible in Hazelcast. Say we have a Java entity:

public class BrtWeekDefinitions {

private Long id;
private BrtTimeCharts brtTimeCharts;
private BrtDayDefinitions brtDayDefinitions;
private Long weekDay;
}

And this entity is loaded in-memory in a map of type: Long, BrtWeekDefinitions.

BrtTimeCharts and BrtDayDefinitions entities are also loaded in their respective maps.

Would this then work?

//Where mapObject is a map of type <Long,BrtWeekDefinitions>
mapObject.addIndex("BrtTimeCharts.id", false); 
mapObject.addIndex("BrtDayDefinitions.id", false);

Or would I have to do such?

//Where mapObject is a map of type <Long,BrtTimeCharts>
mapObject.addIndex("id", false); 

and:

//Where mapObject is a map of type <Long,BrtDayDefinitions>
mapObject.addIndex("id", false); 

Upvotes: 0

Views: 1385

Answers (1)

Vik Gamov
Vik Gamov

Reputation: 5456

Alfred Salah,

This will work

//Where mapObject is a map of type <Long,BrtWeekDefinitions>
mapObject.addIndex("brtTimeCharts.id", false); // use property name not type
mapObject.addIndex("brtDayDefinitions.id", false);

More info about nested indexes here and here

Let me know if you have any questions.

Cheers, Vik

Upvotes: 1

Related Questions