Hello,
I have a question on how to dynamically add SpaceIndexes using the API instead on Nested Properties for a Map. Take the following example where the key that I want the index on in the map is “ExternalId”
package com.myclass
public class MyBaseClass {
private Map nestedMap;
// getter/setters
}
public class MyNextParentClass extends MyBaseClass {
}
public class MyChildClass extends MyNextParentClass {
}
Now when I use the following SpaceIndex annotation
@SpaceIndex (path=nestedMap.ExternalId)
Any searches I do on MyChildClass on key “ExternalId” use the index. I can see the from the new logging that was added to 10.x release, all is good.
However, using the annotation really isn't an option for me because the key that I am searching on could be different depending on the context. Instead, I want to use the GigaSpaceTypeManager api to allow me to customize the indexes at runtime. However when I use the following code, searching never hits the index
gigaspace.getTypeManager().asyncAddIndex("com.myclass.MyChildClass", SpaceIndexFactory.createPropertyIndex("ExternalId", SpaceIndexType.BASIC));
I can see in the GS GUI that the index shows up, but looking at the logging I can clearly see the index doesn't work (I can tell by the search times too). I also tried using “com.myclass.MyBaseClass” instead but that also didn't work.
Can someone point me to better documentation or an example of how to make this work using the API? The documentation is very limited on this
http://docs.gigaspaces.com/xap102/indexing.html
Thanks
Rich
↧