You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2014/02/13 04:09:58 UTC

[02/14] couch-httpd commit: updated refs/heads/1994-merge-rcouch to d936233

couch_replicator: add replication using changes in a view

Instead of a database, the replicator can now filter the documents using
a view index. All documents having a key emitted in the view can be
replicated.

View parameters can be used. Which means that you can replicate results
corresponding to a key in a view or a range.


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

Branch: refs/heads/1994-merge-rcouch
Commit: d936233c8e8c63681cf17c8f76b12f6540827eae
Parents: 792797f
Author: benoitc <be...@apache.org>
Authored: Sun Feb 9 00:43:23 2014 +0100
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Wed Feb 12 21:05:52 2014 -0600

----------------------------------------------------------------------
 src/couch_httpd_changes.erl | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-httpd/blob/d936233c/src/couch_httpd_changes.erl
----------------------------------------------------------------------
diff --git a/src/couch_httpd_changes.erl b/src/couch_httpd_changes.erl
index 1c4a147..6cb0b16 100644
--- a/src/couch_httpd_changes.erl
+++ b/src/couch_httpd_changes.erl
@@ -137,12 +137,15 @@ handle_view_changes(ChangesArgs, Req, Db) ->
     {DDocId, VName} = parse_view_param(Req),
 
     %% get view options
-    Query = case Req of
+    {Query, NoIndex} = case Req of
         {json_req, {Props}} ->
             {Q} = couch_util:get_value(<<"query">>, Props, {[]}),
-            Q;
+            NoIndex1 = (couch_util:get_value(<<"use_index">>, Q,
+                                            <<"yes">>) =:= <<"no">>),
+            {Q, NoIndex1};
         _ ->
-            couch_httpd:qs(Req)
+            NoIndex1 = couch_httpd:qs_value(Req, "use_index", "yes") =:= "no",
+            {couch_httpd:qs(Req), NoIndex1}
     end,
     ViewOptions = parse_view_options(Query, []),
 
@@ -151,8 +154,6 @@ handle_view_changes(ChangesArgs, Req, Db) ->
                              proplists:get_value(update_options, Infos,
                                                  [])),
 
-    NoIndex = couch_httpd:qs_value(Req, "use_index", "yes") =:= "no",
-
     case {IsIndexed, NoIndex} of
         {true, false} ->
             handle_view_changes(Db, DDocId, VName, ViewOptions, ChangesArgs,