couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject [24/49] git commit: Differentiate between keys=undefined and keys=[] in query
Date Fri, 17 Jan 2014 22:10:09 GMT
Differentiate between keys=undefined and keys=[] in query

This commit restores the 1.2 behavior of returning no results when passed an empty keys array.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/commit/4386d420
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/tree/4386d420
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/diff/4386d420

Branch: refs/heads/import
Commit: 4386d4201537f4e791df7d21411a5708f2512d91
Parents: 9256d13
Author: Adam Lofts <Adam.Lofts@gmail.com>
Authored: Sun May 20 15:09:51 2012 +0100
Committer: Jan Lehnardt <jan@apache.org>
Committed: Sun Jun 17 15:42:51 2012 +0200

----------------------------------------------------------------------
 src/couch_mrview_util.erl | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/blob/4386d420/src/couch_mrview_util.erl
----------------------------------------------------------------------
diff --git a/src/couch_mrview_util.erl b/src/couch_mrview_util.erl
index 2d75df9..ba4de2d 100644
--- a/src/couch_mrview_util.erl
+++ b/src/couch_mrview_util.erl
@@ -260,7 +260,8 @@ all_docs_reduce_to_count(Reductions) ->
     {Count, _, _} = couch_btree:final_reduce(Reduce, Reductions),
     Count.
 
-
+reduce_to_count(nil) ->
+    0;
 reduce_to_count(Reductions) ->
     Reduce = fun
         (reduce, KVs) ->
@@ -592,10 +593,7 @@ ad_ekey_opts(#mrargs{end_key_docid=EKeyDocId}=Args) ->
 key_opts(Args) ->
     key_opts(Args, []).
 
-
-key_opts(#mrargs{keys=undefined}=Args, Extra) ->
-    key_opts(Args#mrargs{keys=[]}, Extra);
-key_opts(#mrargs{keys=[], direction=Dir}=Args, Extra) ->
+key_opts(#mrargs{keys=undefined, direction=Dir}=Args, Extra) ->
     [[{dir, Dir}] ++ skey_opts(Args) ++ ekey_opts(Args) ++ Extra];
 key_opts(#mrargs{keys=Keys, direction=Dir}=Args, Extra) ->
     lists:map(fun(K) ->


Mime
View raw message