Re: erlang precommit hook error

2011-11-09 Thread Hal Eisen
My input data is ascii text (not json or xml). Why would riak_object:get_value() return binary data? Can anyone explain how to retrieve, modify and store a riak_object within an Erlang precommit hook? I'm also trying to get some debug info with lager:info() but that seems to be giving an error a

Re: erlang precommit hook error

2011-11-09 Thread Joseph Lambert
AFAIK, When you do riak_object:get_value(), it will return a binary and you are calling string:tokens on a binary value. - Joe Lambert joseph.g.lamb...@gmail.com +86 13656213284 On Wed, Nov 9, 2011 at 4:01 AM, Hal Eisen wrote: > I've made some progress. Looks like I was not compiling my mod

Re: erlang precommit hook error

2011-11-08 Thread Hal Eisen
I've made some progress. Looks like I was not compiling my module, nor did I have the add_paths set in app.config. However, now I'm getting a new failure: error:function_clause When I look in my erlang.log file, I see this: [{string,'tokens1',[<<"my actual data that I am trying to store before

Re: erlang precommit hook error

2011-11-08 Thread Hal Eisen
Sorry, typo in code. the mangle function is actually: mangle(X) -> crypto:start(), {_, Tokens} = lists:partition(fun(Arg) -> lists:member(Arg, mangle:stopwords()) end, string:tokens(riak_object:get_value(X), " ")), riak_object:update_value(X, lists:flatten(lists:map(fun(Arg) -> cryp

erlang precommit hook error

2011-11-08 Thread Hal Eisen
Hello again. I have given up on using the JavaScript precommit hook because I could not find anything which did not produce timeouts under the load for my application. So, I have ported my hook to Erlang. Alas, I'm not getting very far. I've installed my hook in /etc/riak/erl/hooks.erl. The cod