Yes that's the reference I've been using. I went with the {struct, JsonProplist} option because it can be set via the HTTP API.
-Greg On Sat, May 21, 2011 at 11:48 PM, Andrew Berman <rexx...@gmail.com> wrote: > I'll preface this by saying I've never used this feature.... > > rs_extractfun should be set to one of the values defined in the Other > Encodings section ( > http://wiki.basho.com/Riak-Search---Indexing-and-Querying-Riak-KV-Data.html). > In your case, {jsanon, "function(a,b){return{\"user\":\"gpascale\", > \"name\":\"greg\"};}"} > > Hope that helps, > > Andrew > > On Sat, May 21, 2011 at 7:48 PM, Greg Pascale <g...@clipboard.com> wrote: > >> I've been banging my head against the wall trying to get a javascript >> custom extractor working. Here is the simplest example I could come up with >> to reproduce the error. >> >> *curl -v -X PUT -H "Content-Type: application/json" >> http://localhost:8098/riak/test -d @data* >> >> where *@data* is a file that looks like >> >> *{"props":* >> * {"rs_extractfun":* >> * {"language" : "javascript", * >> * "source" : "function(a,b){return{\"user\":\"gpascale\", >> \"name\":\"greg\"};}"* >> * }* >> * }* >> *}* >> * >> * >> This completes successfully, and I can verify it by looking at the >> properties of the "test" bucket. >> >> *{"props":{"allow_mult":true,"basic_quorum":true,"big_vclock":50,"chash_keyfun":{"mod":"riak_core_util","fun":"chash_std_keyfun"},"dw":"quorum","last_write_wins":false,"linkfun":{"mod":"riak_kv_wm_link_walker","fun":"mapreduce_linkfun"},"n_val":3,"name":"test","notfound_ok":false,"old_vclock":86400,"postcommit":[],"pr":0,"precommit":[{"mod":"riak_search_kv_hook","fun":"precommit"}],"pw":0,"r":"quorum","rs_extractfun":{"language":"javascript","source":"function(a,b){return{\"user\":\"gpascale\", >> \"name\":\"greg\"};}"},"rw":"quorum","small_vclock":10,"w":"quorum","young_vclock":20}} >> * >> >> However, when I try to insert something into the bucket, I get an error >> >> *curl -X PUT http://localhost:8098/riak/test/test1 -d "Hello, world!"* >> >> *{error,badarg,* >> * [{erlang,iolist_to_binary,* >> * [{hook_crashed,* >> * {riak_search_kv_hook,precommit,exit,* >> * {noproc,* >> * {gen_server,call,* >> * [riak_search_js_extract,reserve_vm,* >> * infinity]}}}}]},* >> * {wrq,append_to_response_body,2},* >> * {riak_kv_wm_raw,accept_doc_body,2},* >> * {webmachine_resource,resource_call,3},* >> * {webmachine_resource,do,3},* >> * {webmachine_decision_core,resource_call,1},* >> * {webmachine_decision_core,accept_helper,0},* >> * {webmachine_decision_core,decision,1}]}}* >> * >> * >> It doesn't matter if the thing I insert is a string, as above, or real >> json object that matches my schema - the error is the same. Any ideas what >> might be going on here? >> >> Thanks, >> -Greg >> >> _______________________________________________ >> riak-users mailing list >> riak-users@lists.basho.com >> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com >> >> >
_______________________________________________ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com