design doc updater
[disclosr.git] / admin / refreshDesignDoc.php
blob:a/admin/refreshDesignDoc.php -> blob:b/admin/refreshDesignDoc.php
--- a/admin/refreshDesignDoc.php
+++ b/admin/refreshDesignDoc.php
@@ -9,6 +9,9 @@
     $obj->language = "javascript";
     $obj->views->all->map = "function(doc) {   emit(doc._id, doc); };";
     $obj->views->byDate->map = "function(doc) {   emit(doc.date, doc); };";
+    $obj->views->byDate->reduce = "_count";
+    $obj->views->byAgencyID->map = "function(doc) {   emit(doc.agencyID, doc); };";
+    $obj->views->byAgencyID->reduce = "_count";
 
     // allow safe updates (even if slightly slower due to extra: rev-detection check).
  $foidb->save($obj, true);
@@ -82,6 +85,11 @@
  for (name in doc.foiBodies) {
 if (doc.foiBodies[name] != "" && doc.foiBodies[name] != doc.name) {
        	 emit(doc.foiBodies[name], doc._id); 
+}
+        }
+for (name in doc.positions) {
+if (doc.positions[name] != "" && doc.positions[name] != doc.name) {
+       	 emit(doc.positions[name], doc._id); 
 }
         }
         }