anchor.diff:  %% Run the extraction function against the RiakObject to get a list of
   %% search fields and data
   -spec run_extract(riak_object(), extractdef()) -> search_fields().
  -run_extract(RiakObject, {{modfun, Mod, Fun}, Args}) ->
  -    Mod:Fun(RiakObject, Args);
  -run_extract(_, _) ->
  -    throw({error, not_implemented}).
  +run_extract(RiakObject, {{modfun, Mod, Fun}, Arg}) ->
  +    Mod:Fun(RiakObject, Arg);
  +run_extract(RiakObject, {{qfun, Fun}, Arg}) ->
  +    Fun(RiakObject, Arg);
  +run_extract(RiakObject, {JsFunTerm, Arg}) when element(1, JsFunTerm) == jsanon; 
  +                                               element(1, JsFunTerm) == jsfun ->
  +    JsRObj = riak_object:to_json(RiakObject),
  +    case Arg of
  +        undefined ->
  +            JsArg = null;
  +        _ ->
  +            JsArg = Arg
  +    end,
  +    case riak_kv_js_manager:blocking_dispatch({JsFunTerm, [JsRObj, JsArg]}, 5) of
  +        {ok, <<"fail">>} ->
  +            throw(fail);
  +        {ok, [{<<"fail">>, Message}]} ->
  +            throw({fail, Message});
  +        {ok, JsonFields} ->
  +            erlify_json_extract(JsonFields);
  +        {error, Error} ->
  +            error_logger:error_msg("Error executing kv/search hook: ~s",
  +                                   [Error]),
  +            throw({fail, Error})
  +    end;
  +run_extract(_, ExtractDef) ->
  +    throw({error, {not_implemented, ExtractDef}}).
  +
  +erlify_json_extract(R) ->
  +    erlify_json_extract(R, []).
  +
  +erlify_json_extract([], Acc) ->
  +    lists:reverse(Acc);
  +erlify_json_extract([{BinFieldName, FieldData} | Rest], Acc) when is_binary(BinFieldName),
  +                                                                  is_binary(FieldData) ->
  +    erlify_json_extract(Rest, [{binary_to_list(BinFieldName), FieldData} | Acc]);
  +erlify_json_extract(R, _Acc) ->
  +    throw({fail, {bad_json_extractor, R}}).
  +    
   
   -ifdef(TEST).
   
  
positive.code:             Precommit == IndexHook
      end.
  
  -endif. % TEST
      
  
negative.code:          precommit/1]).
  -ifdef(TEST).
  -include_lib("eunit/include/eunit.hrl").
  -export([run_mod_fun_extract_test_fun/2]).
  -endif.
  
  -define(DEFAULT_EXTRACTOR, {modfun, riak_search_kv_extractor, extract}).
  