Permalink
Browse files

MB-7084: Pass on limit parameter in spatial merger

The limit parameter is now passed on to the other nodes when
the spatial view merger is used. Note that the limit is set
to the original limit plus the original skip. The reason is
that you never know which node needs to skip the results to
which amount (but the maximum number of documents needed is
definitely <= limit + skip).

Change-Id: I7fa9884ef673bbe88c034353ca418ef6843702ed
Reviewed-on: http://review.couchbase.org/22228
Reviewed-by: Filipe David Borba Manana <fdmanana@gmail.com>
Reviewed-by: Volker Mische <volker.mische@gmail.com>
Tested-by: Volker Mische <volker.mische@gmail.com>
  • Loading branch information...
1 parent 16b91fb commit 9039a6d75bab3a54a5ee02e53c2f5424ad93e64e @vmx vmx committed Nov 2, 2012
Showing with 9 additions and 1 deletion.
  1. +9 −1 src/geocouch/couch_spatial_merger.erl
@@ -265,7 +265,9 @@ spatial_qs(SpatialArgs) ->
bbox = Bbox,
stale = Stale,
count = Count,
- bounds = Bounds
+ bounds = Bounds,
+ limit = Limit,
+ skip = Skip
} = SpatialArgs,
QsList = case Bbox =:= DefSpatialArgs#spatial_query_args.bbox of
true ->
@@ -292,6 +294,12 @@ spatial_qs(SpatialArgs) ->
false ->
["bounds=" ++ ?b2l(iolist_to_binary(
lists:nth(2, hd(io_lib:format("~p", [Bounds])))))]
+ end ++
+ case Limit =:= DefSpatialArgs#spatial_query_args.limit of
+ true ->
+ [];
+ false ->
+ ["limit=" ++ integer_to_list(Limit + Skip)]
end,
case QsList of
[] ->

0 comments on commit 9039a6d

Please sign in to comment.