riak_search: custom extractor syntax

Mark Phillips mark at basho.com
Wed Jul 20 14:04:25 EDT 2011

Hey Greg,

So here's what looks like is going on:

Everything that requires JS in Riak has to declare a pool of VMs. Each
pool needs to be initialized for functions that depend on them to have
access. In this case, it looks like the Riak Search custom extractor
functionality depends on a pool that's not being initialized. This
would be "riak_search_js_extract".  Sorry for the time you've spent
toiling with this, but it looks like it's a bug.

I've gone ahead and filed an issue on your behalf.


Please add any additional details that you think would be worthwhile,
and thanks for uncovering this.


On Tue, Jul 19, 2011 at 10:40 AM, Greg Pascale <greg at clipboard.com> wrote:
> I've been debugging through the riak code, and it looks like the
> riak_search_js_extract process is not running, so it's not even getting to
> the point of executing my JS. Has this feature ever worked?
> =ERROR REPORT==== 19-Jul-2011::10:25:24 ===
> problem invoking hook riak_search_kv_hook:precommit -> exit:{noproc,
>                                                              {gen_server,
>                                                               call,
> [riak_search_js_extract,
>                                                                reserve_vm,
>                                                                infinity]}}
> [{gen_server,call,3},
>  {riak_kv_js_manager,blocking_dispatch,4},
>  {riak_search_kv_hook,run_extract,3},
>  {riak_search_kv_hook,make_indexed_doc,4},
>  {riak_search_kv_hook,index_object,2},
>  {riak_search_kv_hook,precommit,1},
>  {riak_kv_put_fsm,invoke_hook,4},
>  {riak_kv_put_fsm,precommit,2}]
> -Greg
> On Mon, Jul 18, 2011 at 6:22 PM, Greg Pascale <greg at clipboard.com> wrote:
>> Hi,
>> I'm trying to use a custom extractor, but I can't for the life of me seem
>> to get the syntax right. Even the simplest thing I can think to try won't
>> work.
>> I've tried setting the rs_extractfun property as described in the
>> documentation - both of these methods
>> {jsanon, {Bucket, Key}}, where Bucket and Key name a Riak object that
>> contains the source of a Javascript function to call for extraction.
>> {jsanon, Source}, where Source is the source of a Javascript function to
>> call for extraction.
>> > Client:set_bucket(<<"extractTest">>, [{rs_extractfun, {jsanon,
>> > <<"function(){return{'name':'greg', 'login':'gpascale'};}">>}}]).
>> > Client:set_bucket(<<"extractTest">>, [{rs_extractfun, {jsanon,
>> > {<<"extractors">>, <<"myextractor">>}}}]).
>> but neither of these work.
>> Can somebody point out where I'm going wrong?
>> --
>> Greg
>> Clipboard is hiring!
> --
> Greg
> Clipboard is hiring!
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

More information about the riak-users mailing list