Aha, that clears things up. I'd be careful about that (the effects of post-commit hooks will be invisible to your application) but you can use these functions in riak_client:
-export([get_index/4,get_index/3]). -export([stream_get_index/4,stream_get_index/3]). On Fri, Jul 19, 2013 at 3:48 PM, luigi max <[email protected]> wrote: > What I am trying to do is access 2i information from a post commit hook > written in erlang. What is the best way to do it from there? > > > On Fri, Jul 19, 2013 at 1:32 PM, Sean Cribbs <[email protected]> wrote: > >> You should avoid using the internal client (which isn't a client, >> really), except for debugging. Instead, use >> https://github.com/basho/riak-erlang-client or any of our other >> language-specific clients. See also >> http://docs.basho.com/riak/latest/references/Client-Libraries/ >> >> >> On Fri, Jul 19, 2013 at 3:21 PM, luigi max <[email protected]> wrote: >> >>> I have been looking around the Riak docs and as many other places that >>> I can think of and I can't seem to find how to query 2i with the Riak >>> internal erlang client. >>> >>> I can do a query to 2i with the http interface with: >>> >>> /buckets/TEST/index/pos_int/1/15 >>> >>> and it returns >>> >>> {"keys":["set2i"]} >>> >>> I can create an entry with the following code (loaded into riak): >>> >>> Robj = riak_object:new(<<"TEST">>, <<"set2i">>, void, "application/json"), >>> Lst = [{"pos_int", 5}], >>> Meta = dict:store(<<"index">>,Lst, dict:new()), >>> I2obj = riak_object:update_metadata(Robj, Meta) >>> {ok,C} = riak:local_client(). >>> C:put(I2obj). >>> >>> This works nicely, but the problem I have is with trying to figure out >>> how to do the same query using the native api for riak. The documentation >>> for anything to do with the riak internal client is effectively non >>> existent. >>> >>> What all I need: >>> >>> - information on how to do a integer range query >>> - information on my other 2i query options, in case I need it >>> >>> Any help is much appreciated. >>> >>> -- >>> By Luke Harvey; >>> >>> LinkedIn Profile: http://www.linkedin.com/in/lukeharvey00 >>> >>> _______________________________________________ >>> riak-users mailing list >>> [email protected] >>> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com >>> >>> >> >> >> -- >> Sean Cribbs <[email protected]> >> Software Engineer >> Basho Technologies, Inc. >> http://basho.com/ >> > > > > -- > By Luke Harvey; > > LinkedIn Profile: http://www.linkedin.com/in/lukeharvey00 > -- Sean Cribbs <[email protected]> Software Engineer Basho Technologies, Inc. http://basho.com/
_______________________________________________ riak-users mailing list [email protected] http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
