The reason why a custom function is needed is because he wants to sort
on a key in the javascript object. If it was a list of strings,
calling .sort() would be fine. We need a
Riak.reduceSortByField(values, name) {
return values.sort(function(x,y) {
if(a[key] == b[key]) return 0;
> Iirc, "sort()" is by default lexographic in JavaScript so an added function
> is not necessary. The added function is specifically intended for a custom
> sort, ie. numerical.
>
> You could simply do something like:
>
> return v['key'].sort()
>
> Try that out and lemme know if it works as you exp
Evening, Morning, Afternoon to All -
For today's Recap: new wiki content, new code, and more.
Enjoy.
Mark
Community Manager
Basho Technologies
wiki.basho.com
twitter.com/pharkmillups
--
Riak Recap for May 09 - 10
1) We added a new page to
In JavaScript the default sort order depends on the data types of the
variables in question. If either is a string, you convert the other
to a string and sort lexicographically, but if both are numbers you
compare numerically. There is a similar inconsistency around what the
"+" operation does.
Implementing the m/r functions in Erlang did the trick.
- Jeremy
On 5/10/2011 9:45 AM, Sean Cribbs wrote:
You might see an error in the log, but there are a lot of things about
the JS VM that are too opaque. It's on our list of things to improve,
for sure.
Sean Cribbs mailto:s...@basho.com>>
Iirc, "sort()" is by default lexographic in JavaScript so an added
function is not necessary. The added function is specifically intended
for a custom sort, ie. numerical.
You could simply do something like:
return v['key'].sort()
Try that out and lemme know if it works as you expect.
Chee
> Your compare function will need to return a -1, 0 or 1 for less than,
> the same or greater than. Luckily javascript allows you
> to strings lexicographically so the function is a nice two liner:
>
> function(a, b) {
> if(a == b) return 0;
> return a > b ? 1 : -1;
> }
>
> Application:
>
> va
Your compare function will need to return a -1, 0 or 1 for less than,
the same or greater than. Luckily javascript allows you
to strings lexicographically so the function is a nice two liner:
function(a, b) {
if(a == b) return 0;
return a > b ? 1 : -1;
}
Application:
var reduceSort = func
Hi.
I have a function that performs a numeric sort (ascending) as
described at http://siculars.posterous.com/using-riaks-mapreduce-for-sorting.
But how to perform an alphanumeric sort?
I'm using the code found in the link above:
var reduceSort = function (v, args) {
return v.sort (function(a,
Well, technically searching within a smaller bucket (with much less keys)
should be faster, correct?
On Wed, May 11, 2011 at 12:19 PM, Aphyr wrote:
> Since buckets are essentially key prefixes, I think buckets will probably
> not make this faster. Maybe one of the riak-search experts knows why y
It seems like what you are needing is a lot what the Yammer guys needed for
their streamie application. They have a video here:
http://vimeo.com/21598799 about how they modeled their data. It might be
pretty helpful for your application. If not, no harm done, you still get
to watch a video fr
Since buckets are essentially key prefixes, I think buckets will
probably not make this faster. Maybe one of the riak-search experts
knows why your search is taking so long.
--Kyle
On 05/11/2011 12:00 PM, alexeypro wrote:
Generally the problem there that I may end up with N buckets, where N i
Generally the problem there that I may end up with N buckets, where N is
number of users. If I have 5 to 10 mln of users -- then it's a lot of
buckets. How Riak will handle it?
--
View this message in context:
http://riak-users.197444.n3.nabble.com/Millions-of-buckets-tp2928567p2928642.html
Sent
I have a need to keep "notifications" for "users", where each user has
folders "a", "b" and "c". Also every note has "read" status
Original thought was to create bucket "notifications" which will have the
key user_id, and the value will be JSON object in some structure like this:
{
user_id: "
14 matches
Mail list logo