Error when trying to use a javascript custom extractor in Riaksearch

Andrew Berman rexxe98 at gmail.com
Sun May 22 02:48:12 EDT 2011


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 <greg at 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 at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20110521/a5443f27/attachment.html>


More information about the riak-users mailing list