When in doubt, I always look at the spec. In this case: https://github.com/seancribbs/ripple/blob/master/riak-client/spec/riak/map_reduce/filter_builder_spec.rb
So you'll want to do something roughly like: filter { Riak::MapReduce::FilterBuilder.new } filter.tokenize "-", "1" do eq "test" end There's a really good chance that's wrong since I'm only looking at some Ruby in an editor and not testing against a running Riak cluster right now. Hopefully that sets you on the right track or else angries up someone who will correct me. --- Jeremiah Peschka Founder, Brent Ozar PLF On Sunday, June 5, 2011 at 7:46 PM, Ryan Caught wrote: > 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 (mailto: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 (mailto:riak-users@lists.basho.com) > http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
_______________________________________________ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com