You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by jc...@apache.org on 2008/10/21 22:06:38 UTC

svn commit: r706744 - in /incubator/couchdb/trunk: share/www/script/couch_tests.js src/couchdb/couch_httpd_view.erl

Author: jchris
Date: Tue Oct 21 13:06:37 2008
New Revision: 706744

URL: http://svn.apache.org/viewvc?rev=706744&view=rev
Log:
fix for COUCHDB-139 keys available when reduce=false

Modified:
    incubator/couchdb/trunk/share/www/script/couch_tests.js
    incubator/couchdb/trunk/src/couchdb/couch_httpd_view.erl

Modified: incubator/couchdb/trunk/share/www/script/couch_tests.js
URL: http://svn.apache.org/viewvc/incubator/couchdb/trunk/share/www/script/couch_tests.js?rev=706744&r1=706743&r2=706744&view=diff
==============================================================================
--- incubator/couchdb/trunk/share/www/script/couch_tests.js [utf-8] (original)
+++ incubator/couchdb/trunk/share/www/script/couch_tests.js [utf-8] Tue Oct 21 13:06:37 2008
@@ -1311,6 +1311,10 @@
         T(e.error == "query_parse_error");
     }
 
+    // Test that a map & reduce containing func support keys when reduce=false
+    resp = db.view("test/summate", {reduce: false}, keys);
+    T(resp.rows.length == 5);
+
     // Check that limiting by startkey_docid and endkey_docid get applied
     // as expected.
     var curr = db.view("test/multi_emit", {startkey_docid: 21, endkey_docid: 23}, [0, 2]).rows;

Modified: incubator/couchdb/trunk/src/couchdb/couch_httpd_view.erl
URL: http://svn.apache.org/viewvc/incubator/couchdb/trunk/src/couchdb/couch_httpd_view.erl?rev=706744&r1=706743&r2=706744&view=diff
==============================================================================
--- incubator/couchdb/trunk/src/couchdb/couch_httpd_view.erl (original)
+++ incubator/couchdb/trunk/src/couchdb/couch_httpd_view.erl Tue Oct 21 13:06:37 2008
@@ -346,9 +346,15 @@
             exact ->
                 QueryArgs;
             _ ->
-                Msg = lists:flatten(io_lib:format(
-                    "Multi-key fetches for a reduce view must include group=true", [])),
-                throw({query_parse_error, Msg})
+                #view_query_args{reduce=OptReduce} = QueryArgs,
+                case OptReduce of
+                true ->
+                    Msg = lists:flatten(io_lib:format(
+                        "Multi-key fetches for a reduce view must include group=true", [])),
+                    throw({query_parse_error, Msg});
+                _ -> 
+                    QueryArgs
+                end
             end
         end
     end.