Hi,
I'm having a problem with Ripple and logical operator key filters.  Has
anyone managed to get "and" or "or" key filter combinations working?

When I run the following:

require 'ripple'

client = Riak::Client.new
bucket = client.bucket("test_bucket")

one = Riak::RObject.new(bucket, "test-123")
one.content_type = "application/json"
one.data = '{"name": "test-123"}'
one.store

two = Riak::RObject.new(bucket, "test-456")
two.content_type = "application/json"
two.data = '{"name": "test-456"}'
two.store


results_1 = Riak::MapReduce.new(client).
          add("visitors", [["tokenize", "-", 1], ["eq", "test"]]).
          map("Riak.mapValuesJson", :keep => true).run
# Works as expected
p results_1

results_2 = Riak::MapReduce.new(client).
          add("visitors", [["ends_with", "123"]]).
          map("Riak.mapValuesJson", :keep => true).run
# Works as expected
p results_2

results_3 = Riak::MapReduce.new(client).
          add("test_bucket", ["and", [["tokenize", "-", 1], ["eq", "test"]],
                                     [["ends_with", "123"]]
                          ]).
          map("Riak.mapValuesJson", :keep => true).run
# Error
p results_3




This is what the error report says:

=ERROR REPORT==== 5-Jun-2011::19:42:34 ===
webmachine error: path="/mapred"
{error,{error,function_clause,
              [{riak_client,build_exprs,
                            [[<<"and">>,
                              [[<<"tokenize">>,<<"-">>,1],
                               [<<"eq">>,<<"test">>]],
                              [[<<"ends_with">>,<<"123">>]]],
                             [],
                             {riak_client,'riak@127.0.0.1
',<<6,82,5,153>>}]},
               {riak_client,build_filter,2},
               {riak_client,stream_list_keys,6},
               {riak_client,mapred_bucket_stream,7},
               {riak_client,mapred_bucket,6},
               {riak_kv_wm_mapred,process_post,2},
               {webmachine_resource,resource_call,3},
               {webmachine_resource,do,3}]}}


Any ideas?
_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to