diff --git a/server/maker.js b/server/maker.js index e459c1b..61e7cfa 100644 --- a/server/maker.js +++ b/server/maker.js @@ -47,4 +47,14 @@ nano.db.destroy('keeper', function () { */ - +{ + "getTagByKey": { + "map": function(doc) { + if (doc.tags.list.length > 0) { + for (var t = 0; t < doc.tags.list.length; t++) { + emit(doc._id, [doc.tags.list[t], doc.title]); + } + } + } +} +} diff --git a/server/viewinsert.js b/server/viewinsert.js index 5bf7833..8ebf75c 100644 --- a/server/viewinsert.js +++ b/server/viewinsert.js @@ -21,25 +21,30 @@ var tableList = [ } }, { name: '_design/taglist', view: { + "taglist": { "map": function(doc) { if (doc.type == 1) { emit(null, doc); } } } - }, { + }}, { name: '_design/getAllTags', view: { + "getAllTags": { "map": function(doc) { - if (doc.tags.list.length > 0) { - emit(null, doc.tags.list); - } - } + if (doc.tags.list.length > 0) { + emit(null, doc.tags.list); + } + } + } } }, { - name: '_design/getTagByKey', view: { + name: '_design/getTagByKey', view:{ + "getTagByKey": { "map": function(doc) { - if (doc.tags.list.length > 0) { - for (var t = 0; t < doc.tags.list.length; t++) { - emit(doc._id, [doc.tags.list[t], doc.title]); - } - } - } + if (doc.tags.list.length > 0) { + for (var t = 0; t < doc.tags.list.length; t++) { + emit(doc._id, [doc.tags.list[t], doc.title]); + } + } + } + } } } ];