CouchDB-Why my rerduce is always coming as false ? I am not able to reduce anything properly

96 views Asked by At

I am new to CouchDB. I have a 9 gb dataset loaded into my couchdb. I am able to map everything correctly. But I cannot reduce any of the results using the code written in the reduce column. When i tried log, log shows that rereduce values as false. Do i need to do anything special while doing the Map() or how to set the rereduce value is TRUE??

A sample of my data is as follows:

{
   "_id": "33d4d945613344f13a3ee92933b160bf",
   "_rev": "1-0425ca93e3aa939dff46dd51c3ab86f2",
   "release": {
       "genres": {
           "genre": "Electronic"
       },
       "status": "Accepted",
       "videos": {
           "video": [
               {
                   "title": "[1995] bola - krak jakomo",
                   "duration": 349,
                   "description": "[1995] bola - krak jakomo",
                   "src": "http://www.youtube.com/watch?v=KrELXoYThpI",
                   "embed": true
               },
               {
                   "title": "Bola - Forcasa 3",
                   "duration": 325,
                   "description": "Bola - Forcasa 3",
                   "src": "http://www.youtube.com/watch?v=Lz9itUo5xtc",
                   "embed": true
               },
               {
                   "title": "Bola (Darrell Fitton) - Metalurg (MV)",
                   "duration": 439,
                   "description": "Bola (Darrell Fitton) - Metalurg (MV)",
                   "src": "http://www.youtube.com/watch?v=_MYpOOMRAeQ",
                   "embed": true
               }
           ]
       },
       "labels": {
           "label": {
               "catno": "SKA005",
               "name": "Skam"
           }
       },
       "companies": "",
       "styles": {
           "style": [
               "Downtempo",
               "Experimental",
               "Ambient"
           ]
       },
       "formats": {
           "format": {
               "text": "",
               "name": "Vinyl",
               "qty": 1,
               "descriptions": {
                   "description": [
                       "12\"",
                       "Limited Edition",
                       "33 ⅓ RPM"
                   ]
               }
           }
       },
       "country": "UK",
       "id": 1928,
       "released": "1995-00-00",
       "artists": {
           "artist": {
               "id": 390,
               "anv": "",
               "name": "Bola",
               "role": "",
               "tracks": "",
               "join": ""
           }
       },
       "title": 1,
       "master_id": 13562,
       "tracklist": {
           "track": [
               {
                   "position": "A1",
                   "duration": "4:33",
                   "title": "Forcasa 3"
               },
               {
                   "position": "A2",
                   "duration": "5:48",
                   "title": "Krak Jakomo"
               },
               {
                   "position": "B1",
                   "duration": "7:50",
                   "title": "Metalurg 2"
               },
               {
                   "position": "B2",
                   "duration": "6:40",
                   "title": "Balloom"
               }
           ]
       },
       "data_quality": "Correct",
       "extraartists": {
           "artist": {
               "id": 388200,
               "anv": "",
               "name": "Paul Solomons",
               "role": "Mastered By",
               "tracks": "",
               "join": ""
           }
       },
       "notes": "Limited to 480 copies.\nA1 is a shorter version than that found on the 'Soup' LP.\nA2 ends in a lock groove."
   }
}

My intention is to count the mapped values. My mapping function is as follows:

function(doc){ 
if(doc.release)
emit(doc.release.title,1)
}

Map results shows around 5800 results

I want to use the following functions in the reduce tab to count: Reduce: _count or _sum

It does not give single rounded value. Even i cannot get the simple _count operations right !!! :(

for screenshot,http://s11.postimg.org/lz9ilzhtf/image.png

Please help me !!!

1

There are 1 answers

0
Aurélien Bénel On BEST ANSWER

What you got was the sum of values per title. What you wanted, was the sum of values in general.

Change the grouping drop-down list to none.

Check CouchdDB's wiki for more details on grouping.