diff options
author | Adam Kocoloski <kocolosk@apache.org> | 2010-05-04 02:01:00 +0000 |
---|---|---|
committer | Adam Kocoloski <kocolosk@apache.org> | 2010-05-04 02:01:00 +0000 |
commit | 33b3524268195a0798993690b54cead286da28fb (patch) | |
tree | 3522835f347d8671d44a9e9f966bd3fc4604699e /src/couchdb/couch_rep_changes_feed.erl | |
parent | c2ddcc5d1c5fcbe712031df19ecc12c781d8b613 (diff) |
use keysearch BIF to search ejson props. Closes COUCHDB-747
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@940708 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_rep_changes_feed.erl')
-rw-r--r-- | src/couchdb/couch_rep_changes_feed.erl | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/couchdb/couch_rep_changes_feed.erl b/src/couchdb/couch_rep_changes_feed.erl index 343b445c..c492fcd9 100644 --- a/src/couchdb/couch_rep_changes_feed.erl +++ b/src/couchdb/couch_rep_changes_feed.erl @@ -47,7 +47,7 @@ stop(Server) -> init([_Parent, #http_db{}=Source, Since, PostProps] = Args) -> process_flag(trap_exit, true), - Feed = case proplists:get_value(<<"continuous">>, PostProps, false) of + Feed = case couch_util:get_value(<<"continuous">>, PostProps, false) of false -> normal; true -> @@ -59,11 +59,11 @@ init([_Parent, #http_db{}=Source, Since, PostProps] = Args) -> {"since", Since}, {"feed", Feed} ], - QS = case proplists:get_value(<<"filter">>, PostProps) of + QS = case couch_util:get_value(<<"filter">>, PostProps) of undefined -> BaseQS; FilterName -> - {Params} = proplists:get_value(<<"query_params">>, PostProps, {[]}), + {Params} = couch_util:get_value(<<"query_params">>, PostProps, {[]}), lists:foldr( fun({K, V}, QSAcc) -> Ks = couch_util:to_list(K), @@ -120,8 +120,8 @@ init([_Parent, Source, Since, PostProps] = InitArgs) -> ChangesArgs = #changes_args{ style = all_docs, since = Since, - filter = ?b2l(proplists:get_value(<<"filter">>, PostProps, <<>>)), - feed = case proplists:get_value(<<"continuous">>, PostProps, false) of + filter = ?b2l(couch_util:get_value(<<"filter">>, PostProps, <<>>)), + feed = case couch_util:get_value(<<"continuous">>, PostProps, false) of true -> "continuous"; false -> @@ -144,11 +144,11 @@ init([_Parent, Source, Since, PostProps] = InitArgs) -> {ok, #state{changes_loop=ChangesPid, init_args=InitArgs}}. filter_json_req(Db, PostProps) -> - case proplists:get_value(<<"filter">>, PostProps) of + case couch_util:get_value(<<"filter">>, PostProps) of undefined -> {[]}; FilterName -> - {Query} = proplists:get_value(<<"query_params">>, PostProps, {[]}), + {Query} = couch_util:get_value(<<"query_params">>, PostProps, {[]}), {ok, Info} = couch_db:get_db_info(Db), % simulate a request to db_name/_changes {[ @@ -291,7 +291,7 @@ handle_messages([Chunk|Rest], State) -> #state{reply_to=nil} -> State#state{ count = Count+1, - last_seq = proplists:get_value(<<"seq">>, Props), + last_seq = couch_util:get_value(<<"seq">>, Props), partial_chunk = <<>>, rows=queue:in(Row,Rows) }; @@ -338,16 +338,16 @@ by_seq_loop(Server, Source, StartSeq) -> qs = [{limit, 1000}, {startkey, StartSeq}] }, {Results} = couch_rep_httpc:request(Req), - Rows = proplists:get_value(<<"rows">>, Results), + Rows = couch_util:get_value(<<"rows">>, Results), if Rows =:= [] -> exit(normal); true -> ok end, EndSeq = lists:foldl(fun({RowInfoList}, _) -> - Id = proplists:get_value(<<"id">>, RowInfoList), - Seq = proplists:get_value(<<"key">>, RowInfoList), - {RowProps} = proplists:get_value(<<"value">>, RowInfoList), + Id = couch_util:get_value(<<"id">>, RowInfoList), + Seq = couch_util:get_value(<<"key">>, RowInfoList), + {RowProps} = couch_util:get_value(<<"value">>, RowInfoList), RawRevs = [ - proplists:get_value(<<"rev">>, RowProps), - proplists:get_value(<<"conflicts">>, RowProps, []), - proplists:get_value(<<"deleted_conflicts">>, RowProps, []) + couch_util:get_value(<<"rev">>, RowProps), + couch_util:get_value(<<"conflicts">>, RowProps, []), + couch_util:get_value(<<"deleted_conflicts">>, RowProps, []) ], ParsedRevs = couch_doc:parse_revs(lists:flatten(RawRevs)), Change = {[ |