On Fri, Nov 9, 2012 at 2:48 PM, Julian <jpell...@gmail.com> wrote: > map_reindex(RiakObject, _KeyData, IndexJson) when is_binary(IndexJson) -> > > and the error that the python client gets starts with Exception: > {"phase":0,"error":"function_clause" > > so I don't think it's being received as a binary.
Hi, Julian. You're right, it's not being received as a binary. The MapReduce endpoint expects the 'arg' to be JSON, and decodes it. If you're constructing your 'arg' like so: client.map(['module','function'], {'arg':'foobar'}) then I would expect the binary <<"foobar">> to come through (indeed, it does in my testing). But, if you're constructing like so: client.map(['module','function'], {'arg':{'foobar':1}}) then instead, you'll get a mochijson2-decoded structure. That looks something like this in Erlang: {struct, [{<<"foobar">>, 1}]} More detail about that decoding can be found here: https://github.com/mochi/mochiweb/blob/master/src/mochijson2.erl > And how do I print out some logging information from my map function? I > tried using lager like I found in the riak code, > > lager:error("Arg is ~p", [IndexJson]), > > but I can't find the message in any of the Riak logs. Lager requires a parse transform at compile time. I suggest using the error_logger module. The lager application will pick up any calls to make to error_logger:info_message, :warning_msg, and :error_msg, and dump them in your console.log or error.log, as appropriate. -Bryan _______________________________________________ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com