riak-erlang-client issue with Riak EE 1.2

Dave Parfitt diparfitt at gmail.com
Wed Aug 29 15:54:51 EDT 2012


Hi Julian -
   The riak-erlang-client docs definitely need to be updated for search, index, and map/reduce. 

In the meantime, if you notice on this line:
https://github.com/basho/riak-erlang-client/blob/master/src/riakc_pb_socket.erl#L635
you'll see that the type for Options is "search_options()". 

You can find the definition of search_options() here:
https://github.com/basho/riak-erlang-client/blob/master/include/riakc.hrl#L77

and the definition for search_option() here:
https://github.com/basho/riak-erlang-client/blob/master/include/riakc.hrl#L122

Cheers -
Dave


On Aug 28, 2012, at 7:20 PM, Julian wrote:

> Sure, I see the source code of search/*, but I'm kind of stuck at
> figuring out the search_options properties and whether they can help
> me or not. I've made stabs at 'rows', 'start' and 'sort' and they're
> more or less the intuitive thing (although I couldn't do a reverse
> sort order if I had to).
> 
> 
> I don't see any code in riak_pb that sheds enlightenment; I'm guessing
> that this #rpbsearchqueryrec record is just shoved into a packet and
> sent to the server.
> 
> search_options([{rows, Rows} | Rest], Req) ->
>    search_options(Rest, Req#rpbsearchqueryreq{rows=Rows});
> search_options([{start, Start} | Rest], Req) ->
>    search_options(Rest, Req#rpbsearchqueryreq{start=Start});
> search_options([{sort, Sort} | Rest], Req) ->
>    search_options(Rest, Req#rpbsearchqueryreq{sort=Sort});
> search_options([{filter, Filter} | Rest], Req) ->
>    search_options(Rest, Req#rpbsearchqueryreq{filter=Filter});
> search_options([{df, DF} | Rest], Req) ->
>    search_options(Rest, Req#rpbsearchqueryreq{df=DF});
> search_options([{op, OP} | Rest], Req) ->
>    search_options(Rest, Req#rpbsearchqueryreq{op=OP});
> search_options([{fl, FL} | Rest], Req) ->
>    search_options(Rest, Req#rpbsearchqueryreq{fl=FL});
> search_options([{presort, Presort} | Rest], Req) ->
>    search_options(Rest, Req#rpbsearchqueryreq{presort=Presort});
> search_options([{_, _} | _Rest], _Req) ->
>    erlang:error(badarg).
> 
> Thanks,
> Julian
> 
> On Tue, Aug 28, 2012 at 12:26 PM, Dave Parfitt <diparfitt at gmail.com> wrote:
>> Hello Julian -
>> 
>> Map-reduce is still available, it's just not what riakc_pb_socket:search/* uses under the hood anymore. Both map/reduce and Riak search functionality are implemented in the client using Protocol Buffers now.
>> 
>> The Map/Reduce functions are available here:
>> https://github.com/basho/riak-erlang-client/blob/master/src/riakc_pb_socket.erl#L454
>> 
>> and the Search functions are available here:
>> https://github.com/basho/riak-erlang-client/blob/master/src/riakc_pb_socket.erl#L618
>> 
>> Cheers -
>> Dave





More information about the riak-users mailing list