Hi guys,

I can't really figure out how to properly call riakc_pb_socket:mapred
with key filtering in Erlang Riak client.

I can't really tell if specs or the documentation is correct on this,
but I would assume that the doc is outdated. Hence the question, is key
filtering still avaialble in erlang client and how it is to be used
correctly?

According to online documentation from here:
 
http://docs.basho.com/riak/latest/dev/using/keyfilters/#Constructing-key-filters
call is to be done like this (docs for 1.2 through 1.4 have the same example):
: riakc_pb_socket:mapred(Pid,
:                        { <<"invoices">>, [[<<"ends_with">>,<<"0603">>]]},
:                        Query).

This is out of sync with mapred spec in 1.3 headers (and 1.4):
: %% @doc Perform a MapReduce job across the cluster.
: %%      See the MapReduce documentation for explanation of behavior.
: %% @equiv mapred(Inputs, Query, default_timeout(mapred))
: -spec mapred(pid(), mapred_inputs(), [mapred_queryterm()]) ->
:                     {ok, mapred_result()} |
:                     {error, {badqterm, mapred_queryterm()}} |
:                     {error, timeout} |
:                     {error, term()}.
: mapred(Pid, Inputs, Query) ->
:     mapred(Pid, Inputs, Query, default_timeout(mapred_timeout)).

Where mapred_inputs is typed as follows:
: -type bucket() :: binary(). %% A bucket name.
: -type key() :: binary(). %% A key name.
: -type mapred_inputs() :: [{bucket(), key()} | {bucket(), key(), term()}] |
:                          {modfun, Module::atom(), Function::atom(), [term()]} 
|
:                          bucket() |
:                          {index, bucket(), Index::binary(), key()} |
:                          {index, bucket(), Index::binary(),
:                           StartKey::key(), EndKey::key()}.

The example form documentation will not match the type specs, making
dialyzer to complain a lot.


Thanks,
--
Maciej Borzcęki
Senior Software Developer at Open-RnD Sp. z o.o., Poland
www.open-rnd.pl
mobile: +48 889 117 365, fax: +48 42 657 9079

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

Reply via email to