Yes. I'm using POJO and annotating one of the field with RiakIndex. When I'm reading the object with the key, as the tag field is not part of the object, while writing I dont have the tag value while writing the object.
Class Foo { private String fooId; @RiakIndex(name="barid") private String barid; ..... } When I'm storing the object, I set the barid for the object and storing the object. Annotation is taking care of tagging the object with barid. When I query the object with barId, I have the barId value so I'm setting barId to object and writing it. But If I lookup the object with fooId, as barId value is not part of the object I cant tag the object with barid. SO when I'm writing the object I'm losing the association . So Is there any thing I'm missing to make it part of the object state. That way as you said, When I read-modify-write, the tag value exist all the time. Thanks Santi On Jan 26, 2015 7:46 PM, "Christopher Meiklejohn" <cmeiklej...@basho.com> wrote: > > > On Jan 26, 2015, at 09:45, Santi Kumar <sa...@veradocs.com> wrote: > > > > Hi > > I'm defining a field of an object as 2i index with @RiakIndex. While > creating the object I initialised both the values and stored the object > against the key of that object and stored against the index. > > > > In a separate thread another field of the object is updated where I dont > have handle to the 2i field. So I simply updated the field and stored back. > As the 2i indexed field is not part of the object, that is gone as null and > 2i index is removed from that object. > > > > After this, any search method on the original index key is failing to > return this object. Is there any way to access 2i index corresponding to > the key of object or storing the 2i index field as part of the object. > > > > When I fetch the object with the key, I'm not able to see the filed > which is definied as 2i field? > > > > Please give me some clues on that. > > Hi Santi, > > When writing tags on objects for use with the 2i mechanism, it's required > that you write all tags for the object each write; most client libraries > will handle this if you perform a read-modify-write. Does this help > clarify? > > Thanks, > Chris
_______________________________________________ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com