Hi,
suppose I have the typical view used to index the tags of a document:
// map
function(doc) {
for (var idx in doc.tags) {
emit(doc.tags[idx], 1);
}
}
// and then I have this reduce function to count how many documents I have
for each given tag:
function(key,values) {
return sum(values);
}
and with the following sample documents:
{ "tags" : ["foo", "foo bar"] },
{ "tags" : ["foo", "bar", "foo bar"]}
I get these results:
{"rows":[
{"key":"bar","value":1},
{"key":"foo","value":3},
{"key":"foo bar","value":2}
]}
What I want to do is to get the results ordered by its value so I can know
which are the most used tags for example. I know that the results are
ordered by the key so I guess this could be done if I could use the value
returned by the reduce on it while calling the emit function with something
like emit([reduce_value, tag], null); Is there any way to accomplish that?
Has it sense or am I misunderstanding something?
Thanks in advance
Regards
--
def dagi3d(me)
case me
when :web then "http://dagi3d.net"
when :twitter then "http://twitter.com/dagi3d"
end
end