From cd1620e9d6ad8bda716b5fbe8ff663ef6039c150 Mon Sep 17 00:00:00 2001 From: gered Date: Sun, 6 Apr 2014 16:18:42 -0400 Subject: [PATCH] the name search view should be in the 'search' design doc really... --- couchdb/ascii_library/list.json | 4 ---- couchdb/ascii_library/search.json | 4 ++++ src/toascii/models/db.clj | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/couchdb/ascii_library/list.json b/couchdb/ascii_library/list.json index 4d68ad2..214f7e2 100644 --- a/couchdb/ascii_library/list.json +++ b/couchdb/ascii_library/list.json @@ -11,10 +11,6 @@ }, "byDate": { "map": "function(doc) {\n emit(doc.name, doc.date)\n}" - }, - "uniqueNames": { - "map": "function(doc) {\n emit(doc.name, null)\n}", - "reduce": "function(keys, values) {\n return null;\n}" } } } \ No newline at end of file diff --git a/couchdb/ascii_library/search.json b/couchdb/ascii_library/search.json index b0149b4..8c21216 100644 --- a/couchdb/ascii_library/search.json +++ b/couchdb/ascii_library/search.json @@ -4,6 +4,10 @@ "views": { "hashes": { "map": "function(doc) {\n emit([doc.name, doc.hash], doc._id)\n}" + }, + "names": { + "map": "function(doc) {\n emit(doc.name, null)\n}", + "reduce": "function(keys, values) {\n return null;\n}" } } } \ No newline at end of file diff --git a/src/toascii/models/db.clj b/src/toascii/models/db.clj index aed6a40..346ae6e 100644 --- a/src/toascii/models/db.clj +++ b/src/toascii/models/db.clj @@ -76,5 +76,5 @@ ; to the search term and use it as the end key, effectively meaning "find all matches with keys ; between 'prefix' and 'prefix\u9999'" which works because keys will be sorted lexicographically ; by couchdb - (->> (couch/get-view-with-db (db-library) "list" "uniqueNames" {:startkey query :endkey (str query "\u9999") :group true}) + (->> (couch/get-view-with-db (db-library) "search" "names" {:startkey query :endkey (str query "\u9999") :group true}) (map :key))) \ No newline at end of file