Github user eiri commented on a diff in the pull request:
https://github.com/apache/couchdb-couch/pull/144#discussion_r54163577
--- Diff: src/couch_changes.erl ---
@@ -221,21 +226,25 @@ configure_filter("_view", Style, Req, Db) ->
Msg = "`view` must be of the form `designname/viewname`",
throw({bad_request, Msg})
end;
-configure_filter([$_ | _], _Style, _Req, _Db) ->
+configure_filter([$_ | _], _Style, _Req, _Db, _) ->
throw({bad_request, "unknown builtin filter name"});
-configure_filter("", main_only, _Req, _Db) ->
+configure_filter("", main_only, _Req, _Db, _) ->
{default, main_only};
-configure_filter("", all_docs, _Req, _Db) ->
+configure_filter("", all_docs, _Req, _Db, _) ->
{default, all_docs};
-configure_filter(FilterName, Style, Req, Db) ->
+configure_filter(FilterName, Style, Req, Db, UseFetch) ->
FilterNameParts = string:tokens(FilterName, "/"),
case [?l2b(couch_httpd:unquote(Part)) || Part <- FilterNameParts] of
[DName, FName] ->
- DesignId = <<"_design/", DName/binary>>,
- {ok, DDoc} = ddoc_cache:open_doc(fabric:dbname(Db), DesignId),
+ {ok, DDoc} = open_ddoc(Db, <<"_design/", DName/binary>>),
check_member_exists(DDoc, [<<"filters">>, FName]),
- DIR = fabric_util:doc_id_and_rev(DDoc),
- {fetch, Style, Req, DIR, FName};
+ case UseFetch of
--- End diff --
I believe we can use the same logic as in `open_ddoc/2` to determine if we
want `fetch` or `custom`, i.e.
```
case Db#db.id_tree of
undefined ->
DIR = fabric_util:doc_id_and_rev(DDoc),
{fetch, Style, Req, DIR, FName};
_ ->
{custom, Style, Req, DDoc, FName}
end;
```
Granted, it's less explicit than using `UseFetch` tag, but consider that we
want to get rid of the whole none-clustered business it worth of trade - we'll
need to change less code and wouldn't need to touch couchdb-chttpd at all.
How do you think?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---