You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by paul jobs <we...@gmail.com> on 2008/12/21 23:49:22 UTC

clustering based on 2 columns

*Hope this query is useful to more people who are using couchdb to collect
stats for their web-apps


Map1 collates based on date map2 collates based on name of application
map3 is not quite what i want,
I want to do what map2 does but only for say "2008-12-21" ie today
how do i get today's statistics?
Thanks a lot

map1*:function(doc) { emit(doc.date, doc.count); }
*reduce*:function(keys, values) { return sum(values)}
*"2008-12-20"*17854*"2008-12-21"*102243

*map2*:function(doc) {
emit(doc.appname, doc.count); }*reduce*:function(keys, values) { return
sum(values)}
Key
Value*"animgifts"*92261*"anoninbox"*98*"areucute"*971*"bdayecards"*13532*
"crushometer"*249*"datevalentine"*766*"igarden"*19*"luvgifts"*143*
"newstickers"*561*"ownmenow"*74

*map3*:function(doc) {
emit([doc.appname,doc.date], doc.count); }
*reduce*:function(keys, values) { return sum(values)}

*["animgifts", "2008-12-20"]*10420*["animgifts",
"2008-12-21"]*81871*["anoninbox",
"2008-12-20"]*67*["anoninbox", "2008-12-21"]*31*["areucute", "2008-12-20"]*
434*["areucute", "2008-12-21"]*537*["bdayecards",
"2008-12-20"]*3175*["bdayecards",
"2008-12-21"]*10390*["crushometer", "2008-12-20"]*69*["crushometer",
"2008-12-21"]*180

Re: clustering based on 2 columns

Posted by paul jobs <we...@gmail.com>.
can you give me an example of this query and the corresponding view map
function
or do we need a different reduce function

On Sun, Dec 21, 2008 at 7:27 PM, Antony Blakey <an...@gmail.com>wrote:

> If you want to reduce over the appname, then that has to occur after the
> date in the key.
>
> On 22/12/2008, at 1:47 PM, paul jobs wrote:
>
>  *key=["","2008-12-21"]
>> *or /invites/_view/invites/appdatecount?count=100&group=true&
>> key=["","2008-12-21"]
>>
>> doesnt work either
>> please point out what i m doing wrong
>>
>> On Sun, Dec 21, 2008 at 7:16 PM, paul jobs <we...@gmail.com> wrote:
>>
>>  Key
>>> Value  *["animgifts", "2008-12-20"]*10420*["animgifts", "2008-12-21"]*
>>> 87781*["anoninbox", "2008-12-20"]*67*["anoninbox", "2008-12-21"]*
>>> 31*["areucute",
>>> "2008-12-20"]*434*["areucute", "2008-12-21"]* 680*["bdayecards",
>>> "2008-12-20"]*3175*["bdayecards", "2008-12-21"]* 12447*["crushometer",
>>> "2008-12-20"]*69*["crushometer", "2008-12-21"]* 250*["datevalentine",
>>> "2008-12-20"]*166*["datevalentine", "2008-12-21"]* 635*["igarden",
>>> "2008-12-20"]*16*["igarden", "2008-12-21"]* 42*["luvgifts",
>>> "2008-12-20"]*
>>> 72*["luvgifts", "2008-12-21"]* 81*["newstickers",
>>> "2008-12-20"]*123*["newstickers",
>>> "2008-12-21"]* 582*["ownmenow", "2008-12-20"]*37*["ownmenow",
>>> "2008-12-21"]* 72*["searchsharer", "2008-12-20"]*57*["searchsharer",
>>> "2008-12-21"]* 336*["searchy", "2008-12-21"]*16*["sendlovely",
>>> "2008-12-20"]* 239*["sendlovely", "2008-12-21"]*721*["topbffs",
>>> "2008-12-20"]* 40*["topbffs", "2008-12-21"]*22*["ukissme", "2008-12-20"]*
>>> 2939*["ukissme", "2008-12-21"]*9484   ← Previous Page | Rows per page: 10
>>> 25 50 100 | Next Page →
>>> Showing 1-29 of 29 rows
>>> *map3*:function(doc) {
>>> emit([doc.appname,doc.date], doc.count); }
>>> *reduce*:function(keys, values) { return sum(values)}
>>>
>>> in this
>>> /invites/_view/invites/appdatecount?count=100&group=true&key="2008-12-21"
>>>
>>> or
>>>
>>> /invites/_view/invites/appdatecount?count=100&group=true&key=["2008-12-21"]
>>>
>>> or
>>>
>>> /invites/_view/invites/appdatecount?count=100&group=true&key=[,"2008-12-21"]
>>>
>>> gives rows=[]
>>>
>>> so how 2 query on a particular date
>>>
>>>
>>> On Sun, Dec 21, 2008 at 7:12 PM, paul jobs <we...@gmail.com> wrote:
>>>
>>>  how to query this for a particular say day?and is it possible to pass
>>>> key
>>>> arguments in the futon view interface when we run the view
>>>>
>>>>
>>>> On Sun, Dec 21, 2008 at 4:37 PM, Antony Blakey <antony.blakey@gmail.com
>>>> >wrote:
>>>>
>>>>
>>>>> On 22/12/2008, at 9:19 AM, paul jobs wrote:
>>>>>
>>>>> I want to do what map2 does but only for say "2008-12-21" ie today
>>>>>
>>>>>> how do i get today's statistics?
>>>>>>
>>>>>>
>>>>> Split your date into three components and use them as the key e.g.
>>>>>
>>>>> [doc.appname, doc.date.year, doc.date.month, doc.date.day]
>>>>>
>>>>> This will allow you to get partial reduce results for just one day, or
>>>>> month, or year.
>>>>>
>>>>> Antony Blakey
>>>>> --------------------------
>>>>> CTO, Linkuistics Pty Ltd
>>>>> Ph: 0438 840 787
>>>>>
>>>>> Reflecting on W.H. Auden's contemplation of 'necessary murders' in the
>>>>> Spanish Civil War, George Orwell wrote that such amorality was only
>>>>> really
>>>>> possible, 'if you are the kind of person who is always somewhere else
>>>>> when
>>>>> the trigger is pulled'.
>>>>> -- John Birmingham, "Appeasing Jakarta"
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>
> Antony Blakey
> --------------------------
> CTO, Linkuistics Pty Ltd
> Ph: 0438 840 787
>
> Lack of will power has caused more failure than lack of intelligence or
> ability.
>  -- Flower A. Newhouse
>
>

Re: clustering based on 2 columns

Posted by Antony Blakey <an...@gmail.com>.
If you want to reduce over the appname, then that has to occur after  
the date in the key.

On 22/12/2008, at 1:47 PM, paul jobs wrote:

> *key=["","2008-12-21"]
> *or /invites/_view/invites/appdatecount?count=100&group=true&
> key=["","2008-12-21"]
>
> doesnt work either
> please point out what i m doing wrong
> On Sun, Dec 21, 2008 at 7:16 PM, paul jobs <we...@gmail.com>  
> wrote:
>
>> Key
>> Value  *["animgifts", "2008-12-20"]*10420*["animgifts",  
>> "2008-12-21"]*
>> 87781*["anoninbox", "2008-12-20"]*67*["anoninbox", "2008-12-21"]*  
>> 31*["areucute",
>> "2008-12-20"]*434*["areucute", "2008-12-21"]* 680*["bdayecards",
>> "2008-12-20"]*3175*["bdayecards", "2008-12-21"]*  
>> 12447*["crushometer",
>> "2008-12-20"]*69*["crushometer", "2008-12-21"]* 250*["datevalentine",
>> "2008-12-20"]*166*["datevalentine", "2008-12-21"]* 635*["igarden",
>> "2008-12-20"]*16*["igarden", "2008-12-21"]* 42*["luvgifts",  
>> "2008-12-20"]*
>> 72*["luvgifts", "2008-12-21"]* 81*["newstickers",  
>> "2008-12-20"]*123*["newstickers",
>> "2008-12-21"]* 582*["ownmenow", "2008-12-20"]*37*["ownmenow",
>> "2008-12-21"]* 72*["searchsharer", "2008-12-20"]*57*["searchsharer",
>> "2008-12-21"]* 336*["searchy", "2008-12-21"]*16*["sendlovely",
>> "2008-12-20"]* 239*["sendlovely", "2008-12-21"]*721*["topbffs",
>> "2008-12-20"]* 40*["topbffs", "2008-12-21"]*22*["ukissme",  
>> "2008-12-20"]*
>> 2939*["ukissme", "2008-12-21"]*9484   ← Previous Page | Rows  
>> per page: 10
>> 25 50 100 | Next Page →
>> Showing 1-29 of 29 rows
>> *map3*:function(doc) {
>> emit([doc.appname,doc.date], doc.count); }
>> *reduce*:function(keys, values) { return sum(values)}
>>
>> in this
>> /invites/_view/invites/appdatecount? 
>> count=100&group=true&key="2008-12-21"
>>
>> or
>> /invites/_view/invites/appdatecount? 
>> count=100&group=true&key=["2008-12-21"]
>>
>> or
>> /invites/_view/invites/appdatecount? 
>> count=100&group=true&key=[,"2008-12-21"]
>>
>> gives rows=[]
>>
>> so how 2 query on a particular date
>>
>>
>> On Sun, Dec 21, 2008 at 7:12 PM, paul jobs <we...@gmail.com>  
>> wrote:
>>
>>> how to query this for a particular say day?and is it possible to  
>>> pass key
>>> arguments in the futon view interface when we run the view
>>>
>>>
>>> On Sun, Dec 21, 2008 at 4:37 PM, Antony Blakey <antony.blakey@gmail.com 
>>> >wrote:
>>>
>>>>
>>>> On 22/12/2008, at 9:19 AM, paul jobs wrote:
>>>>
>>>> I want to do what map2 does but only for say "2008-12-21" ie today
>>>>> how do i get today's statistics?
>>>>>
>>>>
>>>> Split your date into three components and use them as the key e.g.
>>>>
>>>> [doc.appname, doc.date.year, doc.date.month, doc.date.day]
>>>>
>>>> This will allow you to get partial reduce results for just one  
>>>> day, or
>>>> month, or year.
>>>>
>>>> Antony Blakey
>>>> --------------------------
>>>> CTO, Linkuistics Pty Ltd
>>>> Ph: 0438 840 787
>>>>
>>>> Reflecting on W.H. Auden's contemplation of 'necessary murders'  
>>>> in the
>>>> Spanish Civil War, George Orwell wrote that such amorality was  
>>>> only really
>>>> possible, 'if you are the kind of person who is always somewhere  
>>>> else when
>>>> the trigger is pulled'.
>>>> -- John Birmingham, "Appeasing Jakarta"
>>>>
>>>>
>>>>
>>>
>>

Antony Blakey
--------------------------
CTO, Linkuistics Pty Ltd
Ph: 0438 840 787

Lack of will power has caused more failure than lack of intelligence  
or ability.
  -- Flower A. Newhouse


Re: clustering based on 2 columns

Posted by paul jobs <we...@gmail.com>.
*key=["","2008-12-21"]
*or /invites/_view/invites/appdatecount?count=100&group=true&
key=["","2008-12-21"]

doesnt work either
please point out what i m doing wrong
On Sun, Dec 21, 2008 at 7:16 PM, paul jobs <we...@gmail.com> wrote:

> Key
> Value  *["animgifts", "2008-12-20"]*10420*["animgifts", "2008-12-21"]*
> 87781*["anoninbox", "2008-12-20"]*67*["anoninbox", "2008-12-21"]* 31*["areucute",
> "2008-12-20"]*434*["areucute", "2008-12-21"]* 680*["bdayecards",
> "2008-12-20"]*3175*["bdayecards", "2008-12-21"]* 12447*["crushometer",
> "2008-12-20"]*69*["crushometer", "2008-12-21"]* 250*["datevalentine",
> "2008-12-20"]*166*["datevalentine", "2008-12-21"]* 635*["igarden",
> "2008-12-20"]*16*["igarden", "2008-12-21"]* 42*["luvgifts", "2008-12-20"]*
> 72*["luvgifts", "2008-12-21"]* 81*["newstickers", "2008-12-20"]*123*["newstickers",
> "2008-12-21"]* 582*["ownmenow", "2008-12-20"]*37*["ownmenow",
> "2008-12-21"]* 72*["searchsharer", "2008-12-20"]*57*["searchsharer",
> "2008-12-21"]* 336*["searchy", "2008-12-21"]*16*["sendlovely",
> "2008-12-20"]* 239*["sendlovely", "2008-12-21"]*721*["topbffs",
> "2008-12-20"]* 40*["topbffs", "2008-12-21"]*22*["ukissme", "2008-12-20"]*
> 2939*["ukissme", "2008-12-21"]*9484   ← Previous Page | Rows per page: 10
> 25 50 100 | Next Page →
> Showing 1-29 of 29 rows
> *map3*:function(doc) {
>  emit([doc.appname,doc.date], doc.count); }
> *reduce*:function(keys, values) { return sum(values)}
>
> in this
> /invites/_view/invites/appdatecount?count=100&group=true&key="2008-12-21"
>
> or
> /invites/_view/invites/appdatecount?count=100&group=true&key=["2008-12-21"]
>
> or
> /invites/_view/invites/appdatecount?count=100&group=true&key=[,"2008-12-21"]
>
> gives rows=[]
>
> so how 2 query on a particular date
>
>
> On Sun, Dec 21, 2008 at 7:12 PM, paul jobs <we...@gmail.com> wrote:
>
>> how to query this for a particular say day?and is it possible to pass key
>> arguments in the futon view interface when we run the view
>>
>>
>> On Sun, Dec 21, 2008 at 4:37 PM, Antony Blakey <an...@gmail.com>wrote:
>>
>>>
>>> On 22/12/2008, at 9:19 AM, paul jobs wrote:
>>>
>>>  I want to do what map2 does but only for say "2008-12-21" ie today
>>>> how do i get today's statistics?
>>>>
>>>
>>> Split your date into three components and use them as the key e.g.
>>>
>>> [doc.appname, doc.date.year, doc.date.month, doc.date.day]
>>>
>>> This will allow you to get partial reduce results for just one day, or
>>> month, or year.
>>>
>>> Antony Blakey
>>> --------------------------
>>> CTO, Linkuistics Pty Ltd
>>> Ph: 0438 840 787
>>>
>>> Reflecting on W.H. Auden's contemplation of 'necessary murders' in the
>>> Spanish Civil War, George Orwell wrote that such amorality was only really
>>> possible, 'if you are the kind of person who is always somewhere else when
>>> the trigger is pulled'.
>>>  -- John Birmingham, "Appeasing Jakarta"
>>>
>>>
>>>
>>
>

Re: clustering based on 2 columns

Posted by Antony Blakey <an...@gmail.com>.
On 22/12/2008, at 3:33 PM, Antony Blakey wrote:

> I'm not working on Sunday by choice, so this thread got the dregs of  
> my attention.

In fact, I'm working so much not by choice that I didn't realise it's  
actually Monday! How the days blur into each other when you're at the  
pointy end of a gig.

Antony Blakey
-------------
CTO, Linkuistics Pty Ltd
Ph: 0438 840 787

There are two ways of constructing a software design: One way is to  
make it so simple that there are obviously no deficiencies, and the  
other way is to make it so complicated that there are no obvious  
deficiencies.
   -- C. A. R. Hoare



Re: clustering based on 2 columns

Posted by Antony Blakey <an...@gmail.com>.
On 22/12/2008, at 3:21 PM, paul jobs wrote:

> /invites/_view/invites/bydate? 
> count=100&group=true&startkey=["2008-12-21"]&endkey=["2008-12-21",{}]
> cool antony it works
> *interesting adding ,{} from startkey or removing ,{} from endkey  
> doesnt
> work

That's because {} sorts after any other value, and the solution is  
obvious when you know that. Sorry my previous responses were  
misleading - I'm not working on Sunday by choice, so this thread got  
the dregs of my attention.

BTW if you had to do a string prefix search you have to use a unicode  
character after the prefix as the endkey, for exactly the same reason.  
I've found that UTF 0xFFF8 is the last value that works. Theoretically  
a unicode collation sepecification could collate that character before  
some others - unicode collation in CouchDB hasn't been considered yet.

In UTF-8 0xFFF8 is: "\xEF\xBF\xB8", which is explicitly needed in e.g.  
Ruby 1.8

Antony Blakey
-------------
CTO, Linkuistics Pty Ltd
Ph: 0438 840 787

There are two ways of constructing a software design: One way is to  
make it so simple that there are obviously no deficiencies, and the  
other way is to make it so complicated that there are no obvious  
deficiencies.
   -- C. A. R. Hoare



Re: clustering based on 2 columns

Posted by paul jobs <we...@gmail.com>.
/invites/_view/invites/bydate?count=100&group=true&startkey=["2008-12-21"]&endkey=["2008-12-21",{}]
cool antony it works
*interesting adding ,{} from startkey or removing ,{} from endkey doesnt
work
*
/invites/_view/invites/bydate?count=100&group=true&startkey=["2008-12-21"]&endkey=["2008-12-21"]

{"rows":[{"key":["2008-12-21","animgifts"],"value":89324},{"key":["2008-12-21","anoninbox"],"value":31},{"key":["2008-12-21","areucute"],"value":699},{"key":["2008-12-21","bdayecards"],"value":13058},{"key":["2008-12-21","crushometer"],"value":263},{"key":["2008-12-21","datevalentine"],"value":639},{"key":["2008-12-21","igarden"],"value":43},{"key":["2008-12-21","luvgifts"],"value":83},{"key":["2008-12-21","newstickers"],"value":600},{"key":["2008-12-21","ownmenow"],"value":72},{"key":["2008-12-21","searchsharer"],"value":348},{"key":["2008-12-21","searchy"],"value":32},{"key":["2008-12-21","sendlovely"],"value":729},{"key":["2008-12-21","topbffs"],"value":42},{"key":["2008-12-21","ukissme"],"value":10071}]}

can you explain how this works
On Sun, Dec 21, 2008 at 8:42 PM, Antony Blakey <an...@gmail.com>wrote:

> http://127.0.0.1:5984/wtf/_view/invites/bydate
> ?group=true&startkey=[%222008-12-21%22]&endkey=[%222008-12-21%22,{}]
>
>
> {"rows":[{"key":["2008-12-21","app1"],"value":12},{"key":["2008-12-21","app2"],"value":5}]}
>
> On 22/12/2008, at 2:59 PM, paul jobs wrote:
>
>  this doesnt work
>> /invites/_view/invites/bydate?count=100&group=true&key=[%222008-12-21%22]
>>
>> {"rows":[]}
>>
>>
>>
>> On 12/21/08, Antony Blakey <an...@gmail.com> wrote:
>>
>>>
>>>
>>> On 22/12/2008, at 2:39 PM, paul jobs wrote:
>>>
>>> antony this doesnt help
>>>
>>>> Key
>>>> Value  *"2008-12-20"*17854*"2008-12-21"*114536
>>>> i get this result when i give your map-reduce view, it doesnt collate by
>>>> appnames after collating by date
>>>>
>>>>
>>> I thought you were reducing over all appnames.
>>>
>>> map:    function(doc) { emit([doc.date, doc.appname], doc.count) }
>>> query:  ...?group=true&key=["2008-12-21"]
>>>
>>> Antony Blakey
>>> -------------
>>> CTO, Linkuistics Pty Ltd
>>> Ph: 0438 840 787
>>>
>>> He who would make his own liberty secure, must guard even his enemy from
>>> repression.
>>> -- Thomas Paine
>>>
>>>
>>>
>>>
> Antony Blakey
> -------------
> CTO, Linkuistics Pty Ltd
> Ph: 0438 840 787
>
> All that is required for evil to triumph is that good men do nothing.
>
>
>

Re: clustering based on 2 columns

Posted by Antony Blakey <an...@gmail.com>.
http://127.0.0.1:5984/wtf/_view/invites/bydate? 
group=true&startkey=[%222008-12-21%22]&endkey=[%222008-12-21%22,{}]

{"rows":[{"key":["2008-12-21","app1"],"value":12},{"key": 
["2008-12-21","app2"],"value":5}]}

On 22/12/2008, at 2:59 PM, paul jobs wrote:

> this doesnt work
> /invites/_view/invites/bydate? 
> count=100&group=true&key=[%222008-12-21%22]
>
> {"rows":[]}
>
>
>
> On 12/21/08, Antony Blakey <an...@gmail.com> wrote:
>>
>>
>> On 22/12/2008, at 2:39 PM, paul jobs wrote:
>>
>> antony this doesnt help
>>> Key
>>> Value  *"2008-12-20"*17854*"2008-12-21"*114536
>>> i get this result when i give your map-reduce view, it doesnt  
>>> collate by
>>> appnames after collating by date
>>>
>>
>> I thought you were reducing over all appnames.
>>
>> map:    function(doc) { emit([doc.date, doc.appname], doc.count) }
>> query:  ...?group=true&key=["2008-12-21"]
>>
>> Antony Blakey
>> -------------
>> CTO, Linkuistics Pty Ltd
>> Ph: 0438 840 787
>>
>> He who would make his own liberty secure, must guard even his enemy  
>> from
>> repression.
>> -- Thomas Paine
>>
>>
>>

Antony Blakey
-------------
CTO, Linkuistics Pty Ltd
Ph: 0438 840 787

All that is required for evil to triumph is that good men do nothing.



Re: clustering based on 2 columns

Posted by paul jobs <we...@gmail.com>.
this doesnt work
/invites/_view/invites/bydate?count=100&group=true&key=[%222008-12-21%22]

{"rows":[]}



On 12/21/08, Antony Blakey <an...@gmail.com> wrote:
>
>
> On 22/12/2008, at 2:39 PM, paul jobs wrote:
>
>  antony this doesnt help
>> Key
>> Value  *"2008-12-20"*17854*"2008-12-21"*114536
>> i get this result when i give your map-reduce view, it doesnt collate by
>> appnames after collating by date
>>
>
> I thought you were reducing over all appnames.
>
> map:    function(doc) { emit([doc.date, doc.appname], doc.count) }
> query:  ...?group=true&key=["2008-12-21"]
>
> Antony Blakey
> -------------
> CTO, Linkuistics Pty Ltd
> Ph: 0438 840 787
>
> He who would make his own liberty secure, must guard even his enemy from
> repression.
>  -- Thomas Paine
>
>
>

Re: clustering based on 2 columns

Posted by Antony Blakey <an...@gmail.com>.
On 22/12/2008, at 2:39 PM, paul jobs wrote:

> antony this doesnt help
> Key
> Value  *"2008-12-20"*17854*"2008-12-21"*114536
> i get this result when i give your map-reduce view, it doesnt  
> collate by
> appnames after collating by date

I thought you were reducing over all appnames.

map:    function(doc) { emit([doc.date, doc.appname], doc.count) }
query:  ...?group=true&key=["2008-12-21"]

Antony Blakey
-------------
CTO, Linkuistics Pty Ltd
Ph: 0438 840 787

He who would make his own liberty secure, must guard even his enemy  
from repression.
   -- Thomas Paine



Re: clustering based on 2 columns

Posted by paul jobs <we...@gmail.com>.
/invites/_view/invites/bydate?count=100&group=true&key="2008-12-21"

{"rows":[{"key":"2008-12-21","value":114651}]}



On 12/21/08, paul jobs <we...@gmail.com> wrote:
>
> antony this doesnt help
> Key
> Value  *"2008-12-20"*17854*"2008-12-21"* 114536
> i get this result when i give your map-reduce view, it doesnt collate by
> appnames after collating by date
>
> On 12/21/08, Antony Blakey <an...@gmail.com> wrote:
>>
>> map:    function(doc) { emit(doc.date, doc.count) }
>> reduce: function(keys, values, rereduce) { return sum(values) }
>>
>> query:  ...?group=true&key="2008-12-21"
>>
>> Antony Blakey
>> --------------------------
>> CTO, Linkuistics Pty Ltd
>> Ph: 0438 840 787
>>
>> Success is not the key to happiness. Happiness is the key to success.
>>  -- Albert Schweitzer
>>
>>
>

Re: clustering based on 2 columns

Posted by Antony Blakey <an...@gmail.com>.
On 22/12/2008, at 2:43 PM, paul jobs wrote:

> this is hte result i need but for a particular date
> Key
> Value   
> *"animgifts"*88653*"anoninbox"*31*"areucute"*698*"bdayecards"*12756*
> "crushometer"*252*"datevalentine"*637*"igarden"*43*"luvgifts"*83*
> "newstickers 
> "*585*"ownmenow"*72*"animgifts"*88652*"anoninbox"*31*"areucute"*
> 698 
> *"bdayecards 
> "*12746*"crushometer"*252*"datevalentine"*637*"igarden"*43*
> "luvgifts"*83*"newstickers"*585*"ownmenow"*72
> function(doc) {
>  if(doc.date=="2008-12-21")
>  emit(doc.appname, doc.count);
> }

Well, that view would probably be a temp view, and hence very  
inefficient.

Antony Blakey
--------------------------
CTO, Linkuistics Pty Ltd
Ph: 0438 840 787

Always have a vision. Why spend your life making other people’s dreams?
  -- Orson Welles (1915-1985)


Re: clustering based on 2 columns

Posted by paul jobs <we...@gmail.com>.
this is hte result i need but for a particular date
Key
Value  *"animgifts"*88653*"anoninbox"*31*"areucute"*698*"bdayecards"*12756*
"crushometer"*252*"datevalentine"*637*"igarden"*43*"luvgifts"*83*
"newstickers"*585*"ownmenow"*72*"animgifts"*88652*"anoninbox"*31*"areucute"*
698*"bdayecards"*12746*"crushometer"*252*"datevalentine"*637*"igarden"*43*
"luvgifts"*83*"newstickers"*585*"ownmenow"*72
function(doc) {
  if(doc.date=="2008-12-21")
  emit(doc.appname, doc.count);
}
 function(keys, values, rereduce) { return sum(values) }

my question is how to pass an argument to the view query

On 12/21/08, paul jobs <we...@gmail.com> wrote:
>
> antony this doesnt help
> Key
> Value  *"2008-12-20"*17854*"2008-12-21"* 114536
> i get this result when i give your map-reduce view, it doesnt collate by
> appnames after collating by date
>
> On 12/21/08, Antony Blakey <an...@gmail.com> wrote:
>>
>> map:    function(doc) { emit(doc.date, doc.count) }
>> reduce: function(keys, values, rereduce) { return sum(values) }
>>
>> query:  ...?group=true&key="2008-12-21"
>>
>> Antony Blakey
>> --------------------------
>> CTO, Linkuistics Pty Ltd
>> Ph: 0438 840 787
>>
>> Success is not the key to happiness. Happiness is the key to success.
>>  -- Albert Schweitzer
>>
>>
>

Re: clustering based on 2 columns

Posted by paul jobs <we...@gmail.com>.
antony this doesnt help
Key
Value  *"2008-12-20"*17854*"2008-12-21"*114536
i get this result when i give your map-reduce view, it doesnt collate by
appnames after collating by date

On 12/21/08, Antony Blakey <an...@gmail.com> wrote:
>
> map:    function(doc) { emit(doc.date, doc.count) }
> reduce: function(keys, values, rereduce) { return sum(values) }
>
> query:  ...?group=true&key="2008-12-21"
>
> Antony Blakey
> --------------------------
> CTO, Linkuistics Pty Ltd
> Ph: 0438 840 787
>
> Success is not the key to happiness. Happiness is the key to success.
>  -- Albert Schweitzer
>
>

Re: clustering based on 2 columns

Posted by Antony Blakey <an...@gmail.com>.
map:    function(doc) { emit(doc.date, doc.count) }
reduce: function(keys, values, rereduce) { return sum(values) }

query:  ...?group=true&key="2008-12-21"

Antony Blakey
--------------------------
CTO, Linkuistics Pty Ltd
Ph: 0438 840 787

Success is not the key to happiness. Happiness is the key to success.
  -- Albert Schweitzer


Re: clustering based on 2 columns

Posted by paul jobs <we...@gmail.com>.
function(doc) {
  if(doc.date=="2008-12-21")
  emit(doc.appname, doc.count);
}

this is the query i need

but this is not a view since it uses the value
so how do i make this a view and use it
thanks

On Sun, Dec 21, 2008 at 7:16 PM, paul jobs <we...@gmail.com> wrote:

> Key
> Value  *["animgifts", "2008-12-20"]*10420*["animgifts", "2008-12-21"]*
> 87781*["anoninbox", "2008-12-20"]*67*["anoninbox", "2008-12-21"]* 31*["areucute",
> "2008-12-20"]*434*["areucute", "2008-12-21"]* 680*["bdayecards",
> "2008-12-20"]*3175*["bdayecards", "2008-12-21"]* 12447*["crushometer",
> "2008-12-20"]*69*["crushometer", "2008-12-21"]* 250*["datevalentine",
> "2008-12-20"]*166*["datevalentine", "2008-12-21"]* 635*["igarden",
> "2008-12-20"]*16*["igarden", "2008-12-21"]* 42*["luvgifts", "2008-12-20"]*
> 72*["luvgifts", "2008-12-21"]* 81*["newstickers", "2008-12-20"]*123*["newstickers",
> "2008-12-21"]* 582*["ownmenow", "2008-12-20"]*37*["ownmenow",
> "2008-12-21"]* 72*["searchsharer", "2008-12-20"]*57*["searchsharer",
> "2008-12-21"]* 336*["searchy", "2008-12-21"]*16*["sendlovely",
> "2008-12-20"]* 239*["sendlovely", "2008-12-21"]*721*["topbffs",
> "2008-12-20"]* 40*["topbffs", "2008-12-21"]*22*["ukissme", "2008-12-20"]*
> 2939*["ukissme", "2008-12-21"]*9484   ← Previous Page | Rows per page: 10
> 25 50 100 | Next Page →
> Showing 1-29 of 29 rows
> *map3*:function(doc) {
>  emit([doc.appname,doc.date], doc.count); }
> *reduce*:function(keys, values) { return sum(values)}
>
> in this
> /invites/_view/invites/appdatecount?count=100&group=true&key="2008-12-21"
>
> or
> /invites/_view/invites/appdatecount?count=100&group=true&key=["2008-12-21"]
>
> or
> /invites/_view/invites/appdatecount?count=100&group=true&key=[,"2008-12-21"]
>
> gives rows=[]
>
> so how 2 query on a particular date
>
>
> On Sun, Dec 21, 2008 at 7:12 PM, paul jobs <we...@gmail.com> wrote:
>
>> how to query this for a particular say day?and is it possible to pass key
>> arguments in the futon view interface when we run the view
>>
>>
>> On Sun, Dec 21, 2008 at 4:37 PM, Antony Blakey <an...@gmail.com>wrote:
>>
>>>
>>> On 22/12/2008, at 9:19 AM, paul jobs wrote:
>>>
>>>  I want to do what map2 does but only for say "2008-12-21" ie today
>>>> how do i get today's statistics?
>>>>
>>>
>>> Split your date into three components and use them as the key e.g.
>>>
>>> [doc.appname, doc.date.year, doc.date.month, doc.date.day]
>>>
>>> This will allow you to get partial reduce results for just one day, or
>>> month, or year.
>>>
>>> Antony Blakey
>>> --------------------------
>>> CTO, Linkuistics Pty Ltd
>>> Ph: 0438 840 787
>>>
>>> Reflecting on W.H. Auden's contemplation of 'necessary murders' in the
>>> Spanish Civil War, George Orwell wrote that such amorality was only really
>>> possible, 'if you are the kind of person who is always somewhere else when
>>> the trigger is pulled'.
>>>  -- John Birmingham, "Appeasing Jakarta"
>>>
>>>
>>>
>>
>

Re: clustering based on 2 columns

Posted by paul jobs <we...@gmail.com>.
Key
Value  *["animgifts", "2008-12-20"]*10420*["animgifts",
"2008-12-21"]*87781*["anoninbox",
"2008-12-20"]*67*["anoninbox", "2008-12-21"]*31*["areucute", "2008-12-20"]*
434*["areucute", "2008-12-21"]*680*["bdayecards",
"2008-12-20"]*3175*["bdayecards",
"2008-12-21"]*12447*["crushometer", "2008-12-20"]*69*["crushometer",
"2008-12-21"]*250*["datevalentine", "2008-12-20"]*166*["datevalentine",
"2008-12-21"]*635*["igarden", "2008-12-20"]*16*["igarden",
"2008-12-21"]*42*["luvgifts",
"2008-12-20"]*72*["luvgifts", "2008-12-21"]*81*["newstickers", "2008-12-20"]
*123*["newstickers", "2008-12-21"]*582*["ownmenow",
"2008-12-20"]*37*["ownmenow",
"2008-12-21"]*72*["searchsharer", "2008-12-20"]*57*["searchsharer",
"2008-12-21"]*336*["searchy", "2008-12-21"]*16*["sendlovely", "2008-12-20"]*
239*["sendlovely", "2008-12-21"]*721*["topbffs", "2008-12-20"]*40*["topbffs",
"2008-12-21"]*22*["ukissme", "2008-12-20"]*2939*["ukissme", "2008-12-21"]*
9484   ← Previous Page | Rows per page: 10 25 50 100 | Next Page →
Showing 1-29 of 29 rows
*map3*:function(doc) {
emit([doc.appname,doc.date], doc.count); }
*reduce*:function(keys, values) { return sum(values)}

in this
/invites/_view/invites/appdatecount?count=100&group=true&key="2008-12-21"

or
/invites/_view/invites/appdatecount?count=100&group=true&key=["2008-12-21"]

or
/invites/_view/invites/appdatecount?count=100&group=true&key=[,"2008-12-21"]

gives rows=[]

so how 2 query on a particular date


On Sun, Dec 21, 2008 at 7:12 PM, paul jobs <we...@gmail.com> wrote:

> how to query this for a particular say day?and is it possible to pass key
> arguments in the futon view interface when we run the view
>
>
> On Sun, Dec 21, 2008 at 4:37 PM, Antony Blakey <an...@gmail.com>wrote:
>
>>
>> On 22/12/2008, at 9:19 AM, paul jobs wrote:
>>
>>  I want to do what map2 does but only for say "2008-12-21" ie today
>>> how do i get today's statistics?
>>>
>>
>> Split your date into three components and use them as the key e.g.
>>
>> [doc.appname, doc.date.year, doc.date.month, doc.date.day]
>>
>> This will allow you to get partial reduce results for just one day, or
>> month, or year.
>>
>> Antony Blakey
>> --------------------------
>> CTO, Linkuistics Pty Ltd
>> Ph: 0438 840 787
>>
>> Reflecting on W.H. Auden's contemplation of 'necessary murders' in the
>> Spanish Civil War, George Orwell wrote that such amorality was only really
>> possible, 'if you are the kind of person who is always somewhere else when
>> the trigger is pulled'.
>>  -- John Birmingham, "Appeasing Jakarta"
>>
>>
>>
>

Re: clustering based on 2 columns

Posted by paul jobs <we...@gmail.com>.
how to query this for a particular say day?and is it possible to pass key
arguments in the futon view interface when we run the view

On Sun, Dec 21, 2008 at 4:37 PM, Antony Blakey <an...@gmail.com>wrote:

>
> On 22/12/2008, at 9:19 AM, paul jobs wrote:
>
>  I want to do what map2 does but only for say "2008-12-21" ie today
>> how do i get today's statistics?
>>
>
> Split your date into three components and use them as the key e.g.
>
> [doc.appname, doc.date.year, doc.date.month, doc.date.day]
>
> This will allow you to get partial reduce results for just one day, or
> month, or year.
>
> Antony Blakey
> --------------------------
> CTO, Linkuistics Pty Ltd
> Ph: 0438 840 787
>
> Reflecting on W.H. Auden's contemplation of 'necessary murders' in the
> Spanish Civil War, George Orwell wrote that such amorality was only really
> possible, 'if you are the kind of person who is always somewhere else when
> the trigger is pulled'.
>  -- John Birmingham, "Appeasing Jakarta"
>
>
>

Re: clustering based on 2 columns

Posted by Antony Blakey <an...@gmail.com>.
On 22/12/2008, at 9:19 AM, paul jobs wrote:

> I want to do what map2 does but only for say "2008-12-21" ie today
> how do i get today's statistics?

Split your date into three components and use them as the key e.g.

[doc.appname, doc.date.year, doc.date.month, doc.date.day]

This will allow you to get partial reduce results for just one day, or  
month, or year.

Antony Blakey
--------------------------
CTO, Linkuistics Pty Ltd
Ph: 0438 840 787

Reflecting on W.H. Auden's contemplation of 'necessary murders' in the  
Spanish Civil War, George Orwell wrote that such amorality was only  
really possible, 'if you are the kind of person who is always  
somewhere else when the trigger is pulled'.
   -- John Birmingham, "Appeasing Jakarta"