You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2018/07/17 15:48:10 UTC

[couchdb] 02/02: support descending=false for partitioned view queries

This is an automated email from the ASF dual-hosted git repository.

rnewson pushed a commit to branch user-partitioned-dbs-wip
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit c70622e24aa0bee29dae30dd01294bf006df9889
Author: Robert Newson <rn...@apache.org>
AuthorDate: Tue Jul 17 16:47:50 2018 +0100

    support descending=false for partitioned view queries
---
 src/couch_mrview/src/couch_mrview_util.erl | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/couch_mrview/src/couch_mrview_util.erl b/src/couch_mrview/src/couch_mrview_util.erl
index c37dde5..d997352 100644
--- a/src/couch_mrview/src/couch_mrview_util.erl
+++ b/src/couch_mrview/src/couch_mrview_util.erl
@@ -593,15 +593,24 @@ update_args(#mrargs{} = Args) ->
         #mrargs{partition=P0} when not is_binary(P0) ->
             mrverror(<<"`partition` must be a string.">>);
 
-        #mrargs{partition=P0, start_key=undefined, end_key=undefined} ->
+        #mrargs{partition=P0, direction=fwd, start_key=undefined, end_key=undefined} ->
             {[P0, LowestKey], [P0, HighestKey]};
 
-        #mrargs{partition=P0, start_key=SK0, end_key=undefined} ->
+        #mrargs{partition=P0, direction=rev, start_key=undefined, end_key=undefined} ->
+            {[P0, HighestKey], [P0, LowestKey]};
+
+        #mrargs{partition=P0, direction=fwd, start_key=SK0, end_key=undefined} ->
             {[P0, SK0], [P0, HighestKey]};
 
-        #mrargs{partition=P0, start_key=undefined, end_key=EK0} ->
+        #mrargs{partition=P0, direction=rev, start_key=SK0, end_key=undefined} ->
+            {[P0, SK0], [P0, LowestKey]};
+
+        #mrargs{partition=P0, direction=fwd, start_key=undefined, end_key=EK0} ->
             {[P0, LowestKey], [P0, EK0]};
 
+        #mrargs{partition=P0, direction=rev, start_key=undefined, end_key=EK0} ->
+            {[P0, HighestKey], [P0, EK0]};
+
         #mrargs{partition=P0, start_key=SK0, end_key=EK0} ->
             {[P0, SK0], [P0, EK0]}
     end,