list keys with key filters

Sam Lang samlang at gmail.com
Sat Apr 21 12:39:08 EDT 2012


Hello,

I am trying to list a subset of keys in a bucket using the python client with the key filter functionality.  My objects are all binary data, with content-type of application/binary.  After adding a bunch of filters to my query, e.g.:

	filters = key_filter.tokenize("/", 1).eq("foo") 
	filters = filters & key_filter.tokenize("/", 2).eq("bar")
	query.add_key_filters(filters)

I'm doing:

    res = query.map("""
			function(v) {
				return [[v.key]];
			}""").run()

    for k in res: print k

This gives the following exception:

"error":"bad_utf8_character_code"

When I use ascii or json objects, I don't get the exception, and the keys get listed properly.  I assume that riak is trying to parse the data of my binary object and failing because the data isn't utf8 encoded.  Is it possible to do this without writing my own data extractor?  Is there a better way to list a subset of keys?

Thanks,
-sam



More information about the riak-users mailing list