summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Kocoloski <adam@cloudant.com>2010-06-15 11:05:37 -0400
committerAdam Kocoloski <adam@cloudant.com>2010-06-15 11:05:37 -0400
commit9692364437c47ef9e13607e996112839f4f48876 (patch)
treed32099dde3d157cd7b7f595d7bd3f69d13d08af6
parent2bdd685dc2c426fc74f5d2c89d8e34653a1c55aa (diff)
update reduce views to work with 0.11 btree api
-rw-r--r--src/fabric_rpc.erl12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/fabric_rpc.erl b/src/fabric_rpc.erl
index d0558697..26aebfb5 100644
--- a/src/fabric_rpc.erl
+++ b/src/fabric_rpc.erl
@@ -132,13 +132,17 @@ reduce_view(DbName, Group0, ViewName, QueryArgs) ->
{NthRed, View} = fabric_view:extract_view(Pid, ViewName, Views, reduce),
ReduceView = {reduce, NthRed, Lang, View},
Acc0 = #view_acc{group_level = GroupLevel, limit = Limit+Skip},
+ Options0 = [{key_group_fun, GroupFun}, {dir, Dir}],
case Keys of
nil ->
- couch_view:fold_reduce(ReduceView, Dir, {StartKey,StartDocId},
- {EndKey,EndDocId}, GroupFun, fun reduce_fold/3, Acc0);
+ Options = [{start_key, {StartKey,StartDocId}},
+ {end_key, {EndKey,EndDocId}} | Options0],
+ couch_view:fold_reduce(ReduceView, fun reduce_fold/3, Acc0, Options);
_ ->
- [couch_view:fold_reduce(ReduceView, Dir, {K,StartDocId}, {K,EndDocId},
- GroupFun, fun reduce_fold/3, Acc0) || K <- Keys]
+
+ [couch_view:fold_reduce(ReduceView, fun reduce_fold/3, Acc0,
+ [{start_key,{K,StartDocId}}, {end_key,{K,EndDocId}} | Options0])
+ || K <- Keys]
end,
rexi:reply(complete).