Question about counters

Luke Bakken lbakken at basho.com
Tue Jul 1 09:23:44 EDT 2014


Hi Alex,

Search in Riak 2.0 does require a JVM to be installed as you found.

create_search_index is part of the master branch of the Python client:

lbakken ~/Projects/basho/riak-python-client (master=)
$ git grep create_search_index
riak/client/operations.py:461:    def create_search_index(self, transport,
index, schema=None, n_val=None):

Could you make a clone of the git repository and use the code from there?

https://github.com/basho/riak-python-client

--
Luke Bakken
CSE
lbakken at basho.com


On Tue, Jul 1, 2014 at 2:10 AM, Alex De la rosa <alex.rosa.box at gmail.com>
wrote:

> I found out on http://docs.basho.com/riak/2.0.0beta1/dev/using/search
> that in Riak 2.0 additional steps are needed... i fixed my code as follows,
> but still crashing:
>
> -----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
> -----+-----+-----+-----+-----
> import riak
> client = riak.RiakClient(protocol='pbc',
> nodes=[{'host':'127.0.0.1','http_port':8098,'pb_port':8087}])
> client.create_search_index('men') # NEW: Creating a search index
> bucket = client.bucket('accounts')
> bucket.enable_search()
> bucket.set_property('search_index', 'men') # NEW: Setting the search index
> to the bucket
> key = bucket.new('alex', data={"username":"Alex","age":25,"sex":"male"},
> content_type='application/json')
> key.store()
> print bucket.search('sex=male')
>
> -----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----
>
> this time seems the Python client is not fully updated again and missing
> functionality (like "counters"):
>
>
> -----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----
> Traceback (most recent call last):
>   File "test.py", line 3, in <module>
>     client.create_search_index('men')
> AttributeError: 'RiakClient' object has no attribute 'create_search_index'
>
> -----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----
>
> Is a problem of the Python client? Or there is something wrong on my code?
> When will it be a Python client update solving all these issues? is a bit
> frustrating wanting to try the features and see you can not do it because
> the client is not fully operational.
>
> Cheers,
> Alex
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20140701/ed07745b/attachment.html>


More information about the riak-users mailing list