Changeset 531 for Dev/trunk/src/server/config/couchdb-design-docs.js
- Timestamp:
- 03/27/14 14:44:36 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/trunk/src/server/config/couchdb-design-docs.js
r525 r531 30 30 _id: "schemaInfo", 31 31 version: "4", 32 viewsVersion: " 1"32 viewsVersion: "2" 33 33 }, 34 34 … … 49 49 by_type: { 50 50 map: function(doc){ 51 emit(doc.type, doc); 52 } 51 emit(doc.type, 1); 52 }, 53 reduce: function(keys,values){ return sum(values); } 53 54 }, 54 55 typeless: { … … 104 105 emit(doc.topic||"(default)",1); 105 106 }, 106 reduce: function(key, values , rereduce) { return sum(values); }107 reduce: function(key, values ) { return sum(values); } 107 108 }, 108 109 all_variables: { … … 137 138 map: function(doc){ 138 139 if ( doc.type !== 'Question' ) { return; } 139 emit(doc.code,doc); 140 } 140 emit(doc.code,1); 141 }, 142 reduce: function(key, values) { return sum(values); } 141 143 }, 142 144 published_by_code: { 143 145 map: function(doc){ 144 if ( doc.type !== 'Question' || !doc.publicationDate ) { return; } 145 emit(doc.code,doc); 146 } 146 if ( doc.type !== 'Question' || 147 !doc.publicationDate ) { return; } 148 emit(doc.code,1); 149 }, 150 reduce: function(key, values) { return sum(values); } 147 151 }, 148 152 lib: { … … 159 163 drafts: { 160 164 map: function(doc){ 161 if ( doc.type !== 'Survey' || doc.publicationDate ) { return; } 165 if ( doc.type !== 'Survey' || 166 doc.publicationDate ) { return; } 162 167 emit(doc._id,doc); 163 168 } … … 165 170 published: { 166 171 map: function(doc){ 167 if ( doc.type !== 'Survey' || !doc.publicationDate ) { return; } 172 if ( doc.type !== 'Survey' || 173 !doc.publicationDate ) { return; } 168 174 emit(doc._id,doc); 169 175 } … … 176 182 language: "javascript", 177 183 views: { 178 by_ dates: {184 by_start_date: { 179 185 map: function(doc){ 180 186 if ( doc.type !== 'SurveyRun' ) { return; } 181 var startDate = doc.startDate || ""; 182 var endDate = doc.endDate || {}; 183 emit([startDate,endDate,doc.liveName||null],doc); 184 } 187 emit(doc.startDate||null,1); 188 }, 189 reduce: function(keys,values){ return sum(values); } 190 }, 191 by_end_date: { 192 map: function(doc){ 193 if ( doc.type !== 'SurveyRun' ) { return; } 194 emit(doc.endDate||{},1); 195 }, 196 reduce: function(keys,values){ return sum(values); } 185 197 } 186 198 } … … 194 206 map: function(doc){ 195 207 if ( doc.type !== 'Response' ) { return; } 196 emit(doc.surveyRunId, doc); 197 } 208 emit(doc.surveyRunId, 1); 209 }, 210 reduce: function(keys,values){ return sum(values); } 198 211 } 199 212 }
Note: See TracChangeset
for help on using the changeset viewer.