Re: Help: Riak Search on Counters
Oh, cool! Thanks! I will have to look for Solr's documentation then ;) Alex On Monday, August 18, 2014, Eric Redmond wrote: > That's a Solr query, which you can find in the Solr documentation. But my > initial through would be: > > bucket.search("counter:*" sort="counter desc", rows=5) > > Eric > > > On Aug 18, 2014, at 12:06 PM, Alex De la rosa > wrote: > > Hi Sean, > > Thank you for the "counter" field trick :) > > What id you don't know the max value and you want the top 5 cities? In > your example you assume 3 or upper. > > Thanks! > Alex > > On Monday, August 18, 2014, Sean Cribbs > wrote: > >> Hi Alex, >> >> Bare counters become the "counter" field in the Solr index. For counts >> greater than 3 you might query with "counter:[3 TO *]". >> >> Hope that helps! >> >> On Mon, Aug 18, 2014 at 8:01 AM, Alex De la rosa >> wrote: >> > 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 >> > >> > ___ >> > riak-users mailing list >> > riak-users@lists.basho.com >> > http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com >> > >> >> >> >> -- >> Sean Cribbs >> Software Engineer >> Basho Technologies, Inc. >> http://basho.com/ >> > ___ > riak-users mailing list > riak-users@lists.basho.com > > http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com > > > ___ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Re: Help: Riak Search on Counters
That's a Solr query, which you can find in the Solr documentation. But my initial through would be: bucket.search("counter:*" sort="counter desc", rows=5) Eric On Aug 18, 2014, at 12:06 PM, Alex De la rosa wrote: > Hi Sean, > > Thank you for the "counter" field trick :) > > What id you don't know the max value and you want the top 5 cities? In your > example you assume 3 or upper. > > Thanks! > Alex > > On Monday, August 18, 2014, Sean Cribbs wrote: > Hi Alex, > > Bare counters become the "counter" field in the Solr index. For counts > greater than 3 you might query with "counter:[3 TO *]". > > Hope that helps! > > On Mon, Aug 18, 2014 at 8:01 AM, Alex De la rosa > wrote: > > 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 > > > > ___ > > riak-users mailing list > > riak-users@lists.basho.com > > http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com > > > > > > -- > Sean Cribbs > Software Engineer > Basho Technologies, Inc. > http://basho.com/ > ___ > riak-users mailing list > riak-users@lists.basho.com > http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com ___ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Re: Help: Riak Search on Counters
Hi Sean, Thank you for the "counter" field trick :) What id you don't know the max value and you want the top 5 cities? In your example you assume 3 or upper. Thanks! Alex On Monday, August 18, 2014, Sean Cribbs wrote: > Hi Alex, > > Bare counters become the "counter" field in the Solr index. For counts > greater than 3 you might query with "counter:[3 TO *]". > > Hope that helps! > > On Mon, Aug 18, 2014 at 8:01 AM, Alex De la rosa > > wrote: > > 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 > > > > ___ > > riak-users mailing list > > riak-users@lists.basho.com > > http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com > > > > > > -- > Sean Cribbs > > Software Engineer > Basho Technologies, Inc. > http://basho.com/ > ___ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Re: Help: Riak Search on Counters
Also note that you don't run "enable_search" for 2.0. On Aug 18, 2014, at 11:50 AM, Sean Cribbs wrote: > Hi Alex, > > Bare counters become the "counter" field in the Solr index. For counts > greater than 3 you might query with "counter:[3 TO *]". > > Hope that helps! > > On Mon, Aug 18, 2014 at 8:01 AM, Alex De la rosa > wrote: >> 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 >> >> ___ >> riak-users mailing list >> riak-users@lists.basho.com >> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com >> > > > > -- > Sean Cribbs > Software Engineer > Basho Technologies, Inc. > http://basho.com/ > > ___ > riak-users mailing list > riak-users@lists.basho.com > http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com ___ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Re: Help: Riak Search on Counters
Hi Alex, Bare counters become the "counter" field in the Solr index. For counts greater than 3 you might query with "counter:[3 TO *]". Hope that helps! On Mon, Aug 18, 2014 at 8:01 AM, Alex De la rosa wrote: > 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 > > ___ > riak-users mailing list > riak-users@lists.basho.com > http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com > -- Sean Cribbs Software Engineer Basho Technologies, Inc. http://basho.com/ ___ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Help: Riak Search on Counters
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 ___ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com