From 2c8bc8ed6a2dc4ecdde08e779e4882f189485271 Mon Sep 17 00:00:00 2001 From: John Christopher Anderson Date: Sun, 10 May 2009 09:12:01 +0000 Subject: Refactor the make_view_fold_function stuff. Added a proper Acc to both map and reduce view folds. Cleaned up some pattern matchers. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@773319 13f79535-47bb-0310-9956-ffa450edef68 --- src/couchdb/couch_httpd_db.erl | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src/couchdb/couch_httpd_db.erl') diff --git a/src/couchdb/couch_httpd_db.erl b/src/couchdb/couch_httpd_db.erl index b129d37e..f603def0 100644 --- a/src/couchdb/couch_httpd_db.erl +++ b/src/couchdb/couch_httpd_db.erl @@ -457,21 +457,21 @@ all_docs_view(Req, Db, Keys) -> true -> StartDocId end, FoldAccInit = {Limit, SkipCount, undefined, []}, - - PassedEndFun = - case Dir of - fwd -> - fun(ViewKey, _ViewId) -> - couch_db_updater:less_docid(EndKey, ViewKey) - end; - rev-> - fun(ViewKey, _ViewId) -> - couch_db_updater:less_docid(ViewKey, EndKey) - end - end, - + case Keys of nil -> + PassedEndFun = + case Dir of + fwd -> + fun(ViewKey, _ViewId) -> + couch_db_updater:less_docid(EndKey, ViewKey) + end; + rev-> + fun(ViewKey, _ViewId) -> + couch_db_updater:less_docid(ViewKey, EndKey) + end + end, + FoldlFun = couch_httpd_view:make_view_fold_fun(Req, QueryArgs, CurrentEtag, Db, TotalRowCount, #view_fold_helper_funs{ reduce_count = fun couch_db:enum_docs_reduce_to_count/1, -- cgit v1.2.3