-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlist.json
41 lines (41 loc) · 1.58 KB
/
list.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{
"_id": "_design/items",
"language": "javascript",
"lists": {
"csv": "function(head, req){ start({ 'headers': { 'Content-Type': 'text/csv' } });
send('ID, Title, Subject, Publisher, Description, Type|');
function strip(string) { if (typeof string == 'object') { string = string.toString(); } return string ? string.replace(/\\W*/g, '') : ''; }
while(row = getRow()) {
send(
'\"' + row.value.id +
'\",\"' + strip(row.value.title) +
'\",\"' + strip(row.value.creator) +
'\",\"' + strip(row.value.subject) +
'\",\"' + strip(row.value.publisher) +
'\",\"' + strip(row.value.description) +
'\",\"' + strip(row.value.type) +
'\"|');
}
}"
},
"views": {
"all": {
"map": "
function(doc) { emit(doc._id, {
'id' : doc._id,
'title' : doc.title,
'creator' : doc.creator,
'subject' : doc.subject[0].name,
'publisher' : doc.publisher,
'description' : doc.description,
'type' : doc.type
});
}
"
},
"provider": {
"map": "function(doc) {\n\n emit(doc.dplaContributor.name, 1);\n}",
"reduce": "function(keys, values)\n{\n return sum(values);\n}"
}
}
}