Skip to content
Browse files

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.
  • Loading branch information...
1 parent 20586a7 commit cff4957ff80003fc93518b5e5dde8668e9d88007 @adamlofts adamlofts committed with janl May 20, 2012
Showing with 3 additions and 5 deletions.
  1. +3 −5 src/couch_mrview/src/couch_mrview_util.erl
View
8 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) ->

0 comments on commit cff4957

Please sign in to comment.
Something went wrong with that request. Please try again.