/[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

Contents of /deploy/reblog.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 11 - (show annotations)
Fri Aug 8 19:20:13 2008 UTC (15 years, 9 months ago) by dpavlin
File MIME type: text/plain
File size: 1270 byte(s)
some views
1 #!/usr/bin/perl
2
3 use warnings;
4 use strict;
5
6 use CouchDB::Deploy;
7
8 use strip;
9
10 my $reduce_count = qq|
11 function (Key, Values) {
12 var sum = 0;
13 for(var i in Values)
14 sum += Values[i];
15 return sum;
16 }
17 |;
18
19 db 'reblog/', containing {
20 # doc {
21 # _id => '_sync',
22 # key => '_sync',
23 # last_row_id => 0,
24 # };
25 design {
26 _id => '_design/count',
27 language => 'javascript',
28 views => {
29 'feed_items' => {
30 'map' => strip(qq|
31 function(doc) {
32 emit(doc.feed_title, 1);
33 }
34 |),
35 'reduce' => strip($reduce_count),
36 },
37 'tags' => {
38 'map' => strip(qq|
39 function(doc) {
40 var tags = doc.category.split(/[\\s\/]/);
41 for(var i in tags) {
42 emit(tags[i], 1);
43 }
44 }
45 |),
46 'reduce' => strip($reduce_count),
47 }
48 },
49 _id => '_design/items',
50 language => 'javascript',
51 views => {
52 'by_feed' => {
53 'map' => strip(qq|
54 function(doc) {
55 emit(
56 [ doc.feed_title, doc.feed_link ],
57 [ doc.title, doc.link ]
58 );
59 }
60 |),
61 'reduce' => strip(qq|
62 function (k, v) {
63 return v;
64 }
65 |),
66 },
67 'by_date' => {
68 'map' => strip(qq|
69 function(doc) {
70 emit(
71 [ doc.insert_timestamp, doc.feed_title, doc.feed_link ],
72 [ doc.title, doc.link ]
73 );
74 }
75 |),
76 }
77 },
78 };
79 };

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26