Help: Riak Search on Counters

Alex De la rosa alex.rosa.box at gmail.com
Mon Aug 18 09:01:34 EDT 2014


Hi there,

Can somebody help me with Riak Search 2.0 on Counters? Imagine we have a
counter called "visitors" to store how many people visits certain cities:

---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
---- ---- ---- ---- ---- ---- ---- ---- ----

  client.create_search_index('testing')
  bucket = client.bucket_type('visitors').bucket('counter_bucket')
  bucket.enable_search()
  bucket.set_property('search_index', 'testing')

  c = bucket.new('Barcelona')
  c.increment(5)
  c.store()

  c = bucket.new('Tokyo')
  c.increment(2)
  c.store()

  c = bucket.new('Paris')
  c.increment(4)
  c.store()

---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
---- ---- ---- ---- ---- ---- ---- ---- ----

How would we use Riak Search 2.0 in this "visitors" bucket to get which
city has more visitors? (in this case Barcelona)

---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
---- ---- ---- ---- ---- ---- ---- ---- ----

  r = bucket.search('?????') # <---  Pattern to fill up

---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
---- ---- ---- ---- ---- ---- ---- ---- ----

Thanks!
Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20140818/cb2d0026/attachment.html>


More information about the riak-users mailing list