From 0f9df2ebaa7cecf88c5514a5cf897d63eaa22659 Mon Sep 17 00:00:00 2001 From: Zach Lankton Date: Tue, 23 Aug 2022 20:39:02 +0000 Subject: [PATCH] simplified using built in couch utilities --- src/fabric/src/fabric_view_all_docs.erl | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/fabric/src/fabric_view_all_docs.erl b/src/fabric/src/fabric_view_all_docs.erl index 8649f9739b3..bc974fa9d63 100644 --- a/src/fabric/src/fabric_view_all_docs.erl +++ b/src/fabric/src/fabric_view_all_docs.erl @@ -286,22 +286,15 @@ all_docs_concurrency() -> 10 end. -get_query_list(undefined) -> - []; -get_query_list(List) when is_list(List) -> - List. validate_if_partition(Row, Acc) -> - QueryList = get_query_list(Acc#vacc.req#httpd.qs), - case couch_util:get_value("partition", QueryList) of + case chttpd:qs_value(Acc#vacc.req, "partition") of undefined -> Row; - Id -> is_doc_in_partition(Row, Id) + Partition -> is_doc_in_partition(Row, list_to_binary(Partition)) end. -is_doc_in_partition(Row, Id) -> - BinRowKey = Row#view_row.key, - IsDocInPartition = binary:match(BinRowKey, list_to_binary(Id)) /= nomatch, - case IsDocInPartition of +is_doc_in_partition(Row, Partition) -> + case couch_partition:is_member(Row#view_row.key, Partition) of true -> Row; - false -> #view_row{key = BinRowKey} + false -> #view_row{key = Row#view_row.key} end. doc_receive_loop(Keys, Pids, SpawnFun, MaxJobs, Callback, AccIn) ->