Repository: couchdb-couch
Updated Branches:
  refs/heads/master 171b7513a -> 07ba2c035


Extent fetch ddoc logic for view filtered changes feeds


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

Branch: refs/heads/master
Commit: 07ba2c0350375dc03b7eb266ed3040887bc9b320
Parents: 171b751
Author: Eric Avdey <e...@eiri.ca>
Authored: Mon Feb 29 16:11:12 2016 -0400
Committer: Eric Avdey <e...@eiri.ca>
Committed: Tue Mar 15 15:43:42 2016 -0300

----------------------------------------------------------------------
 src/couch_changes.erl | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/07ba2c03/src/couch_changes.erl
----------------------------------------------------------------------
diff --git a/src/couch_changes.erl b/src/couch_changes.erl
index 29c2269..248ba3d 100644
--- a/src/couch_changes.erl
+++ b/src/couch_changes.erl
@@ -208,14 +208,21 @@ configure_filter("_view", Style, Req, Db) ->
         [DName, VName] ->
             {ok, DDoc} = open_ddoc(Db, <<"_design/", DName/binary>>),
             check_member_exists(DDoc, [<<"views">>, VName]),
-            try
+            FilterType = try
                 true = couch_util:get_nested_json_value(
                         DDoc#doc.body,
                         [<<"options">>, <<"seq_indexed">>]
                 ),
-                {fast_view, Style, DDoc, VName}
+                fast_view
             catch _:_ ->
-                {view, Style, DDoc, VName}
+                view
+            end,
+            case Db#db.id_tree of
+                undefined ->
+                    DIR = fabric_util:doc_id_and_rev(DDoc),
+                    {fetch, FilterType, Style, DIR, VName};
+                _ ->
+                    {FilterType, Style, DDoc, VName}
             end;
         [] ->
             Msg = "`view` must be of the form `designname/viewname`",
@@ -236,7 +243,7 @@ configure_filter(FilterName, Style, Req, Db) ->
             case Db#db.id_tree of
                 undefined ->
                     DIR = fabric_util:doc_id_and_rev(DDoc),
-                    {fetch, Style, Req, DIR, FName};
+                    {fetch, custom, Style, Req, DIR, FName};
                 _ ->
                     {custom, Style, Req, DDoc, FName}
             end;

Reply via email to