Hi Gal,
Which version of the client are you using?

On 19 Jan 2012, at 08:19, Gal Barnea wrote:

> Hi
> Is there a way to insert 2i fields using the PB Java client?
Yes, if you're using the current 1.0.x version.

The way to do it is to add the indexes to the object you're storing. So if 
you're storing an IRiakObject then using the builder, or straight on the 
IRiakObject, just call

    addIndex(name, value);

If you're storing some domain object (using the JSON converter) then you can 
annotate fields with the @RiakIndex annotation.

There's an example of both in the tests for the client[1][2].

Cheers

Russell

[1] 
https://github.com/basho/riak-java-client/blob/master/src/test/java/com/basho/riak/client/itest/ITestBucket.java#L186
 
[2] 
https://github.com/basho/riak-java-client/blob/master/src/test/java/com/megacorp/commerce/Customer.java#L37
 and
        
https://github.com/basho/riak-java-client/blob/master/src/test/java/com/basho/riak/client/itest/ITestORM.java#L176
        
> It seems that this is not possible, so I'm wondering what kind of workarounds 
> exists  
> 
> Is this something that can be done in a Post-Commit hook? if so, will inserts 
> still be faster than the HTTP interface?
> 
> Thanks
> Gal
> 
> 
> _______________________________________________
> riak-users mailing list
> [email protected]
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com


_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to