Thanks, If I use a logical & I get no data.
If I just use a greater than than it works. date_start = '2012122300' date_end = '2012122323' filters = key_filter.tokenize(":", filter_map['date']).greater_than_eq(date_start) & key_filter.tokenize(":", filter_map['date']).less_than_eq(date_end) query.add_key_filters(filters) filters = key_filter.tokenize(":", 4) + (key_filter.string_to_int().greater_than_eq(date_start)) query.add_key_filters(filters) I event tried between filters = key_filter.tokenize(":", 4) + (key_filter.between(date_start,date_end)) query.add_key_filters(filters) print filters These are the results for one day. I am really at a loss as to why I cant get riak to work with what should be very simple logical conditions cid5989410021||null||2012122314 1 cid5989410021||null||2012122306 1 cid5989410021||www.sonems.net||2012122305 1 cid5989410021||www.ke5ter.com||2012122406 1 cid5989410021||mobile.brothersoft.com||2012122315 1 cid5989410021||www.renotalk.com||2012122315 1 query.map(''' function(value, keyData, arg) { if(value.length == 0){ return []; }else{ var data = Riak.mapValuesJson(value)[0]; var obj = {}; var xs = value.key.split(':'); var dt = xs[3]; if(data['adx']=='gdn'){ try{ var matches = data['url'].match(/^https?\:\/\/([^\/?#]+)(?:[\/?#]|$)/i); var domain = matches && matches[1]; var alt_key = data['campaign_id'] + '||' + domain + '||' + dt; } catch(err){ var alt_key = 'error'; } var obj = {}; obj[alt_key] = 1; return [ obj ]; }else{ return []; } } }''') reducer = """ function(values, arg){ if(values.length == 0){ return [{}] } return [ values.reduce( function(acc, item) { for (var state in item) { if (acc[state]) acc[state] += item[state]; else acc[state] = item[state]; } return acc; })]; } On Mon, Dec 24, 2012 at 7:19 AM, Evan Vigil-McClanahan < emcclana...@basho.com> wrote: > It looks to me like your error is here: > > > filters = key_filter.tokenize(":", 4) + > (key_filter.starts_with('20121223') and key_filter.string_to_int().less_than > (2012122423)) > > The 'and' there is getting interpreted as a logical and: > > >>> key_filter.starts_with('20121223') and > key_filter.string_to_int().less_than(2012122423) > [['string_to_int'], ['less_than', 2012122423]] > > You have to use the sadly non-idiomatic '&' to get it to do what > you're trying to do: > > >>> key_filter.tokenize(":", 4) + (key_filter.starts_with('20121223') & > key_filter.string_to_int().less_than(2012122423)) > [['tokenize', ':', 4], ['and', [['starts_with', '20121223']], > [['string_to_int'], ['less_than', 2012122423]]]] >
_______________________________________________ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com