Can someone confirm that the logical AND operation used with tokenize does not 
work?  According to the website (http://wiki.basho.com/Key-Filters.html), it 
should work, but it does not work for me.

David


From: David Mitchell
Sent: Thursday, June 02, 2011 6:41 PM
To: 'riak-users@lists.basho.com'
Subject: Key-Filters with logical AND operation and with tokenize

I am trying to use the following Key-Filters with logical AND operation and 
tokenize, but I am getting errors.  Anyone know what might be wrong?  Is it 
possible to use tokenize with the logical AND?

Erlang: R13B04
Riak: 0.14.2

Bucket: zip
Key: 22305-0-1-3

The following does not work:
{
                "inputs" : {
                                "bucket" : "zip",
                                "key_filters" : ["and", [["starts_with", 
"22305-0"]], [["tokenize", "-", 4], ["between", "1", "3"]]]
                },
                "query" : [{
                                                "map" : {
                                                                "keep" : true,
                                                                "language" : 
"javascript",
                                                                "arg" : null,
                                                                "source" : 
"function (v) { return [Riak.mapValuesJson(v)[0]]; }"
                                                }
                                }
                ]
}

I get the following error:
{error,{error,function_clause,[{riak_client,build_exprs,[[<<\"and\">>,[[<<\"starts_with\">>,<<\"22305-0\">>]],[[<<\"tokenize\">>,<<\"-\">>,2],[<<\"between\">>,<<\"1\">>,<<\"3\">>]]],[],{riak_client,'riak@10.0.60.208',<<3,171,198,76>>}]},{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}]}}

The following does work:
{
                "inputs" : {
                                "bucket" : "zip",
                                "key_filters" : [["tokenize", "-", 4], 
["between", "1", "5"]]
                },
                "query" : [{
                                                "map" : {
                                                                "keep" : true,
                                                                "language" : 
"javascript",
                                                                "arg" : null,
                                                                "source" : 
"function (v) { return [Riak.mapValuesJson(v)[0]]; }"
                                                }
                                }
                ]
}

David

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

Reply via email to