anchor.diff:          case wait_db_updated(Timeout, TimeoutFun) of
           updated ->
               {ok, Db2} = couch_db:open(DbName, [{user_ctx, UserCtx}]),
  -            keep_sending_changes(Req, Resp, Db2, EndSeq, Prepend2, Timeout, TimeoutFun, ResponseType);
  +            keep_sending_changes(Req, Resp, Db2, EndSeq, Prepend2, Timeout,
  +                TimeoutFun, ResponseType, Filter, End);
           stop ->
               end_sending_changes(Resp, EndSeq, ResponseType)
           end
  
positive.code:     send_chunk(Resp, "{\"results\":[\n").
  
  handle_changes_req(#httpd{method='GET',path_parts=[DbName|_]}=Req, Db) ->
      StartSeq = list_to_integer(couch_httpd:qs_value(Req, "since", "0")),
      {ok, Resp} = start_json_response(Req, 200),
      ResponseType = couch_httpd:qs_value(Req, "feed", "normal"),
  
negative.code:         fun() -> ok end};
      [DName, FName] ->
          DesignId = <<"_design/", DName/binary>>,
          case couch_db:open_doc(Db, DesignId) of
          {ok, #doc{body={Props}}} ->
              FilterSrc = try couch_util:get_nested_json_value({Props},
                  [<<"filters">>, FName])
              catch
              throw:{not_found, _} ->
                  throw({bad_request, "invalid filter function"})
              end,
              Lang = proplists:get_value(<<"language">>, Props, <<"javascript">>),
              {ok, Pid} = couch_query_servers:start_filter(Lang, FilterSrc),
              FilterFun = fun(DInfo = #doc_info{revs=[#rev_info{rev=Rev}|_]}) ->
                  {ok, Doc} = couch_db:open_doc(Db, DInfo, [deleted]),
                  {ok, Pass} = couch_query_servers:filter_doc(Pid, Doc, Req, Db),
                  case Pass of
                  true ->
                      {[{rev, couch_doc:rev_to_str(Rev)}]};
                  false ->
                      null
                  end
              end,
              EndFilterFun = fun() ->
                  couch_query_servers:end_filter(Pid)
              end,
              {FilterFun, EndFilterFun};
          _Error ->
              throw({bad_request, "invalid design doc"})
          end;
      _Else ->
          throw({bad_request, 
              "filter parameter must be of the form `designname/filtername`"})
  