You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2012/06/17 17:14:52 UTC
[2/3] git commit: Differentiate between keys=undefined and keys=[] in
query
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/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/cff4957f
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/cff4957f
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/cff4957f
Branch: refs/heads/master
Commit: cff4957ff80003fc93518b5e5dde8668e9d88007
Parents: 20586a7
Author: Adam Lofts <Ad...@gmail.com>
Authored: Sun May 20 15:09:51 2012 +0100
Committer: Jan Lehnardt <ja...@apache.org>
Committed: Sun Jun 17 15:42:51 2012 +0200
----------------------------------------------------------------------
src/couch_mrview/src/couch_mrview_util.erl | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/cff4957f/src/couch_mrview/src/couch_mrview_util.erl
----------------------------------------------------------------------
diff --git a/src/couch_mrview/src/couch_mrview_util.erl b/src/couch_mrview/src/couch_mrview_util.erl
index 2d75df9..ba4de2d 100644
--- a/src/couch_mrview/src/couch_mrview_util.erl
+++ b/src/couch_mrview/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) ->