incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nebu Pookins <nebupook...@gmail.com>
Subject Re: how to get documents by two or more keys?
Date Thu, 31 Mar 2011 15:19:40 GMT
On Tue, Mar 29, 2011 at 1:06 PM, Gabor Ratky
<gabor@secretsaucepartners.com> wrote:
> you can always come up with 'smart' complex keys where the data you need ends up together,
one query away.

What would the smart key be for this scenario?

Your documents have represent entities on an infinite 2D field, and
each document has an attribute representing their X and Y coordinates,
among other things.

You wish to find only the entities that are within the rectilinear
rectangle defined by the top left corner (x1,y1) and bottom-right
corner (x2,y2); or equivalently by its top-left corner and its width
and height.

I've been trying to think of a mapping of the points on a 2D plane to
a 1D line, that would map the opposite corners of the rectangle as
opposite endpoints of a line, but I haven't been able to find any such
mapping that works for arbitrary coordinates of the rectangle.

- Nebu

Mime
View raw message