Welcome to the new Gigaspaces XAP forum. To recover your account, please follow these instructions.

Ask Your Question
0

Compound indexes with dynamic properties

Hi. I want to create a spaceClass with the following data:

MyClass

  • id

  • data1 (Index BASIC)

  • data2

  • dp1 (Index BASIC)

  • dp2 (Index BASIC)

  • .... any other data

Data1 and Data2 are regular POJO attributes and DP1 and DP2 are dynamic properties. Some of the properties have BASIC indexes. Is the following class declaration and annotations correct? (Specially the dynamic properties)

 @Entity
 @Table(name="my_class")
 @SpaceClass
 public class MyClass {

        String id;
        String data1;
        String data2;

        DocumentProperties properties  = new DocumentProperties();

        @Id
        @Column(name="id", unique=true)
        @SpaceId(autoGenerate=false)
        public String getId() {
            return id;
        }

        public void setId(String id){
            this.id = id;
        }

        @Column(name="data1")
        @SpaceIndex(type=SpaceIndexType.BASIC)
        @SpaceProperty
        public String getData1(){
            return data1;
        }

        public void setData1(String data1){
            this.data1 = data1;
        }

        @Column(name="data2")
        @SpaceIndex(type=SpaceIndexType.BASIC)
        @SpaceProperty
        public String getData2(){
            return data2;
        }

        public void setData2(String data2){
            this.data2 = data2;
        }

        // DynamicProperties

        @Transient
        @Transient
        @SpaceIndexes({
            @SpaceIndex(path = "dp1", type = SpaceIndexType.BASIC)
        })
        @SpaceDynamicProperties
        public DocumentProperties getProperties() {
            return properties;
        }

        @Column(name="dp1")
        @SpaceExclude
        public String getDP1(){
            return properties.getProperty("dp1");
        }

        public void setDP1(String dp1){
            properties.setProperty("dp1", dp1);
        }

        @Column(name="dp2")
        @SpaceExclude
        public String getDP2(){
            return  properties.getProperty("dp2");
        }

        public void setDP1(String dp2){
            properties.setProperty("dp2", dp2);
        }

    }

If I have some polling container and internal queries that uses two or even the three indexes attributes, how can I define the compound indexes? I see the documentation at http://docs.gigaspaces.com/xap100/ind... and want to know if is it possible to mix the regular indexes with the compound indexes. In other words, if I add the following annotations the class definition will be correct?

@Entity
@Table(name="my_class")
@CompoundSpaceIndexes(
{
    @CompoundSpaceIndex(paths = {"dp1", "dp2"}) },
    @CompoundSpaceIndex(paths = {"data1", "dp1", "dp2"}) }
)
@SpaceClass
public class MyClass {

 ... The same as the previous example
}

Thanks, Manuel

asked 2015-01-29 15:37:01 -0500

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

A compound index using multiple segments is not supported.

Can you provide examples for the queries you are trying to execute?

Why can't you list all the compound index attributes like this:

@CompoundSpaceIndexes( { @CompoundSpaceIndex(paths = {"dp1", "dp2","data1"}) } } )

answered 2015-01-30 08:58:22 -0500

shay hassidim gravatar image
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-01-29 15:37:01 -0500

Seen: 181 times

Last updated: Jan 30 '15