It does work, but the and/or/not examples in the wiki only show the filter 
operation that would be passed in to the filters parameter, not the entire 
contents.

The wiki's
["and", [["ends_with", "0603"]], [["starts_with", "basho"]]]
should really be
[["and", [["ends_with", "0603"]], [["starts_with", "basho"]]]]

http://lists.basho.com/pipermail/riak-users_lists.basho.com/2011-May/004305.html
 is Mathias's response to my questions on the subject.
--- 
Jeremiah Peschka
Founder, Brent Ozar PLF


On Monday, June 6, 2011 at 6:54 AM, David Mitchell wrote:

> 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: '[email protected] (mailto:[email protected])'
> 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,'[email protected]
>  
> (mailto:[email protected])',<<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
> [email protected] (mailto:[email protected])
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to