couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chewbra...@apache.org
Subject [1/3] couch commit: updated refs/heads/add-filter-revs-limit to 6198f80
Date Mon, 12 Oct 2015 19:26:55 GMT
Repository: couchdb-couch
Updated Branches:
  refs/heads/add-filter-revs-limit 1628a3ae9 -> 6198f804c


Update revs limit


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/07e5eac3
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/07e5eac3
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/07e5eac3

Branch: refs/heads/add-filter-revs-limit
Commit: 07e5eac38a04bfa91e6fb96e89cd799270f23119
Parents: 1628a3a
Author: Russell Branca <chewbranca@apache.org>
Authored: Mon Oct 12 19:25:01 2015 +0000
Committer: Russell Branca <chewbranca@apache.org>
Committed: Mon Oct 12 19:25:01 2015 +0000

----------------------------------------------------------------------
 src/couch_query_servers.erl | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/07e5eac3/src/couch_query_servers.erl
----------------------------------------------------------------------
diff --git a/src/couch_query_servers.erl b/src/couch_query_servers.erl
index d26e6af..72d2329 100644
--- a/src/couch_query_servers.erl
+++ b/src/couch_query_servers.erl
@@ -280,12 +280,23 @@ validate_doc_update(DDoc, EditDoc, DiskDoc, Ctx, SecObj) ->
             throw({unknown_error, Message})
     end.
 
-json_doc(nil) -> null;
+json_doc_options() ->
+    json_doc_options([]).
+
+json_doc_options(Options) ->
+    Limit = config:get_integer("query_server_config", "revs_limit", 20),
+    [{revs, Limit} | Options].
+
 json_doc(Doc) ->
-    couch_doc:to_json_obj(Doc, [revs]).
+    json_doc(Doc, json_doc_options()).
+
+json_doc(nil, _) ->
+    null;
+json_doc(Doc, Options) ->
+    couch_doc:to_json_obj(Doc, Options).
 
 filter_view(DDoc, VName, Docs) ->
-    JsonDocs = [couch_doc:to_json_obj(Doc, [revs]) || Doc <- Docs],
+    JsonDocs = [json_doc(Doc) || Doc <- Docs],
     [true, Passes] = ddoc_prompt(DDoc, [<<"views">>, VName, <<"map">>],
[JsonDocs]),
     {ok, Passes}.
 
@@ -296,8 +307,7 @@ filter_docs(Req, Db, DDoc, FName, Docs) ->
     #httpd{} = HttpReq ->
         couch_httpd_external:json_req_obj(HttpReq, Db)
     end,
-    Limit = config:get_integer("query_server_config", "filter_revs_limit", 20),
-    JsonDocs = [couch_doc:to_json_obj(Doc, [{revs, Limit}]) || Doc <- Docs],
+    JsonDocs = [json_doc(Doc) || Doc <- Docs],
     [true, Passes] = ddoc_prompt(DDoc, [<<"filters">>, FName],
         [JsonDocs, JsonReq]),
     {ok, Passes}.


Mime
View raw message