diff options
author | Robert Newson <rnewson@apache.org> | 2018-07-17 16:47:50 +0100 |
---|---|---|
committer | Robert Newson <rnewson@apache.org> | 2018-07-17 16:47:50 +0100 |
commit | c70622e24aa0bee29dae30dd01294bf006df9889 (patch) | |
tree | 05021e043dd6dca19241becbc1211a721f57d0ad | |
parent | 4fef53ce7423ce20c699918cd727f92454a900b7 (diff) | |
download | couchdb-c70622e24aa0bee29dae30dd01294bf006df9889.tar.gz |
support descending=false for partitioned view queries
-rw-r--r-- | src/couch_mrview/src/couch_mrview_util.erl | 15 |
1 files 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 c37dde567..d99735234 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, |