/[couchdb]/deploy/reblog.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /deploy/reblog.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 11 by dpavlin, Fri Aug 8 19:20:13 2008 UTC revision 16 by dpavlin, Sun Aug 31 00:04:39 2008 UTC
# Line 8  use CouchDB::Deploy; Line 8  use CouchDB::Deploy;
8  use strip;  use strip;
9    
10  my $reduce_count = qq|  my $reduce_count = qq|
11  function (Key, Values) {          function (Key, Values) {
12          var sum = 0;                  var sum = 0;
13          for(var i in Values)                  for(var i in Values)
14                  sum += Values[i];                          sum += Values[i];
15          return sum;                  return sum;
16  }          }
17    |;
18    
19    my $reduce_join = qq|
20            function (k, v, c) {
21                    if ( c ) {
22                            a = v.shift();
23                            //log( a ); log( v );
24                            while ( v.length ) {
25                                    //log( v.length );
26                                    e = v.shift();
27                                    //log( e );
28                                    a.concat( e );
29                            }
30                            return a;
31                    } else {
32                            return v;
33                    }
34            }
35  |;  |;
36    
37  db 'reblog/', containing {  db 'reblog/', containing {
# Line 58  db 'reblog/', containing { Line 76  db 'reblog/', containing {
76                                                  );                                                  );
77                                          }                                          }
78                                  |),                                  |),
79                                  'reduce' => strip(qq|                                  'reduce' => strip($reduce_join),
80                                          function (k, v) {                          },
81                                                  return v;                          'by_feed_html' => {
82                                    'map' => strip(qq|
83                                            function(doc) {
84                                                    emit(
85                                                            [ doc.feed_title, doc.feed_link ],
86                                                            '<a href="' + doc.link + '">' + doc.title + '</a>'
87                                                    );
88                                          }                                          }
89                                  |),                                  |),
90                                    'reduce' => strip($reduce_join),
91                          },                          },
92                          'by_date' => {                          'by_date' => {
93                                  'map' => strip(qq|                                  'map' => strip(qq|
94  function(doc) {                                          function(doc) {
95          emit(                                                  emit(
96                  [ doc.insert_timestamp, doc.feed_title, doc.feed_link ],                                                          [ doc.insert_timestamp, doc.feed_title, doc.feed_link ],
97                  [ doc.title, doc.link ]                                                          [ doc.title, doc.link ]
98          );                                                  );
99  }                                          }
100                                  |),                                  |),
101                          }                          }
102                  },                  },

Legend:
Removed from v.11  
changed lines
  Added in v.16

  ViewVC Help
Powered by ViewVC 1.1.26