Querying 2i using erlang native api

Sean Cribbs sean at basho.com
Fri Jul 19 17:20:06 EDT 2013


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 <ldc.drake at gmail.com> 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 <sean at basho.com> 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 <ldc.drake at gmail.com> 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
>>> riak-users at lists.basho.com
>>> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>>>
>>>
>>
>>
>> --
>> Sean Cribbs <sean at basho.com>
>> Software Engineer
>> Basho Technologies, Inc.
>> http://basho.com/
>>
>
>
>
> --
> By Luke Harvey;
>
> LinkedIn Profile:  http://www.linkedin.com/in/lukeharvey00
>



-- 
Sean Cribbs <sean at basho.com>
Software Engineer
Basho Technologies, Inc.
http://basho.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20130719/03e42c85/attachment.html>


More information about the riak-users mailing list