--- a/admin/refreshDesignDoc.php +++ b/admin/refreshDesignDoc.php @@ -13,7 +13,16 @@ $obj->views->byDateMonthYear->reduce = "_count"; $obj->views->byAgencyID->map = "function(doc) { emit(doc.agencyID, doc); };"; $obj->views->byAgencyID->reduce = "_count"; +$obj->views->fieldNames->map = ' +function(doc) { +for(var propName in doc) { + emit(propName, doc._id); + } +}'; +$obj->views->fieldNames->reduce = 'function (key, values, rereduce) { + return values.length; +}'; // allow safe updates (even if slightly slower due to extra: rev-detection check). $foidb->save($obj, true); @@ -31,7 +40,8 @@ $obj->views->byURL->map = "function(doc) {\n emit(doc.url, doc);\n}"; $obj->views->agency->map = "function(doc) {\n emit(doc.agencyID, doc);\n}"; $obj->views->byWebServer->map = "function(doc) {\n emit(doc.web_server, doc);\n}"; -$obj->views->getValidationRequired = "function(doc) {\nif (doc.mime_type == \"text/html\" \n&& typeof(doc.validation) == \"undefined\") {\n emit(doc._id, doc._attachments);\n}\n}"; +$obj->views->getValidationRequired->map = "function(doc) {\nif (doc.mime_type == \"text/html\" \n&& typeof(doc.validation) == \"undefined\") {\n emit(doc._id, doc._attachments);\n}\n}"; +$docdb->save($obj, true);