nickva commented on code in PR #4862:
URL: https://github.com/apache/couchdb/pull/4862#discussion_r1422774834


##########
src/couch/src/couch_changes.erl:
##########
@@ -264,6 +264,26 @@ filter(Db, DocInfo, {custom, Style, Req0, DDoc, FName}) ->
     {ok, Passes} = couch_query_servers:filter_docs(Req, Db, DDoc, FName, Docs),
     filter_revs(Passes, Docs).
 
+filter(Db, DocInfo, {selector, Style, {Selector, _Fields}}, IncludeDocs) when 
IncludeDocs ->
+    Docs = open_revs(Db, DocInfo, Style),
+    Passes = [mango_selector:match(Selector, couch_doc:to_json_obj(Doc, [])) 
|| Doc <- Docs],
+    {Docs, filter_revs(Passes, Docs)};
+filter(Db, DocInfo, {view, Style, DDoc, VName}, IncludeDocs) when IncludeDocs 
->
+    Docs = open_revs(Db, DocInfo, Style),
+    {ok, Passes} = couch_query_servers:filter_view(Db, DDoc, VName, Docs),
+    {Docs, filter_revs(Passes, Docs)};
+filter(Db, DocInfo, {custom, Style, Req0, DDoc, FName}, IncludeDocs) when 
IncludeDocs ->
+    Req =
+        case Req0 of
+            {json_req, _} -> Req0;
+            #httpd{} -> {json_req, chttpd_external:json_req_obj(Req0, Db)}
+        end,
+    Docs = open_revs(Db, DocInfo, Style),
+    {ok, Passes} = couch_query_servers:filter_docs(Req, Db, DDoc, FName, Docs),
+    {Docs, filter_revs(Passes, Docs)};
+filter(Db, DocInfo, Filter, _IncludeDocs) ->

Review Comment:
   ah you're right, it could be both, we want to pass through to the filter/3 
call



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to