I set a custom schema with a 20 digit (~64-bit) integer field:

{field, [
{name, "account"},
{type, integer},
{padding_size, 20}
]},

But I can only query with a 10 digit padded string:

>>> [l.get_key() for l in client.search('answers', 'account:%010d' %
(12345678)).run()]
[u'test']
>>> [l.get_key() for l in client.search('answers', 'account:%d' %
(12345678)).run()]
[]
>>> [l.get_key() for l in client.search('answers', 'account:%020d' %
(12345678)).run()]
[]

Additionally, I can't search for any ints larger than signed 32-bit.

>>> client.bucket('answers').new('2**31', {'account': 2**31}).store()
<riak.riak_object.RiakObject object at 0x10064ee90>
>>> client.bucket('answers').new('2**31-1', {'account': 2**31-1}).store()
<riak.riak_object.RiakObject object at 0x10064e550>
>>> [l.get_key() for l in client.search('answers', 'account:{%010d TO
%010d}' % (0, 2**33)).run()]
[u'test', u'2%2A%2A31-1']

General work-around seems to be to just use the string type and manage
padding on my own [example on a bucket with the default schema]:

>>> client.bucket('questions').new('2**64', {'account': '%020d' %
2**64}).store()
<riak.riak_object.RiakObject object at 0x10064e550>
>>> client.bucket('questions').new('2**32', {'account': '%020d' %
2**32}).store()
<riak.riak_object.RiakObject object at 0x1006510d0>
>>> [l.get_key() for l in client.search('questions', 'account:{%020d TO
%020d}' % (2**32-1, 2**64+1)).run()]
[u'2%2A%2A64', u'2%2A%2A32']
>>> [l.get_key() for l in client.search('questions', 'account:%020d' %
2**64).run()]
[u'2%2A%2A64']
>>> [l.get_key() for l in client.search('questions', 'account:%020d' %
2**32).run()]
[u'2%2A%2A32']

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

Reply via email to