Hi all,

I have question about how views work. I read that when you create a view, CouchDB indexes it so it's faster on the next request. But if I pass in startkey and endkey, does it only index the docs that are returned? Or is the entire list indexed and CouchDB returns the offsets as requested?

What I'm doing is querying a database and emitting a geo calculation of miles from a center point, then passing in startkey and endkey to only show results in a certain range.

e.g. http://hostname/locations/_design/search/_view/[view_name]? startkey=0.0&endkey=1.0

returns

{"id":"5b3c7273b8c5c2a822bae3a4c70add84","key": 0.63269276577514,"value":"Location Name"}, {"id":"40286e8e47b7e1300560893caa38f1ff","key": 0.6677870430738252,"value":"Another Location Name"}

Where key is the distance from the origin, and value is the name of the location.

My thought is to generate a new view for each new center point requested, but if each view will store whole list, that seems inefficient.

Thanks,
-Matt

Reply via email to