anchor.diff:      proplists:get_value(<<"_yz_rk">>, X)
     end, KeysExt)};
   get_keys(Conn, Conditions, Bucket, Max, Skip, Sort) ->
  -  lager:info("~p", [build_search_query(Conditions)]),
     {ok, {search_results, KeysExt, _, _}} = riakc_pb_socket:search(
       Conn, list_to_binary(Bucket), list_to_binary(build_search_query(Conditions)), [{rows, Max}, {start, Skip}, {sort, Sort}]),
     {ok, lists:map(fun ({_,X}) ->
  
positive.code:     {K, V} = check_key(Key, Value),
      build_search_query(Rest, [lists:concat(["NOT ", K, ":", quote_value(V)])|Acc]);
  build_search_query([{Key, 'in', Value}|Rest], Acc) when is_list(Value) ->
      {K, V} = check_key(Key, Value),
      build_search_query(Rest, [lists:concat([K, ":", "(", string:join(lists:map(fun(Val) ->
                                      lists:concat([quote_value(Val)])
                              end, V), " OR "), ")"])|Acc]);
  build_search_query([{Key, 'not_in', Value}|Rest], Acc) when is_list(Value) ->
      {K, V} = check_key(Key, Value),
      build_search_query(Rest, [lists:concat(["NOT ", K, ":", "(", string:join(lists:map(fun(Val) ->
                                      lists:concat([quote_value(Val)])
                              end, V), " AND "), ")"])|Acc]);
  
negative.code: % this is a stub just to make the tests runable
  count(Conn, Type, Conditions) ->
    Bucket = type_to_bucket_name(Type),
    {ok, {search_results, _, _, Count}} = case Conditions of
                                            [] ->  riakc_pb_socket:search(Conn, list_to_binary(Bucket),
                                              list_to_binary("_yz_id:*"),
  