Spacial search with GeoCouch

6 views
Skip to first unread message

Chris Costakes

unread,
May 17, 2013, 8:12:40 AM5/17/13
to us...@couchdb.apache.org
Using CouchDB (and GeoCouch), I have a document type of Location with a
center coordinate (lat & long). I am able to query with a bbox query just
fine by feeding in a northwest longitude/latitude and a southwest
longitude/latitued. My location doc also has an attribute called Users
where I have an array of user id's. I would like to be able to perform a
bbox with the addition of filtering by a specific user in the Users array.
Is this possible?

The reason important is because I may have millions of different location
documents, each with a list of users in the User array (maybe hundreds of
user tags per location). I'm trying to find a list of locations for a group
of users. So I have 3 users for a particular search and I want to find all
of the locations for these users within a given boundry. The only way I can
think to handle this scenario is to perform the bbox spatial query first
and then loop through the result set to determine if the user matches the
list of the 3 users. This would mean looping through a potentially very
large original result set (the list of locations). Would love to add an
additional dimension to my bbox query to filter also by user, but I can't
figure out how to accomplish this or whether it is possible. Thank you!

Volker Mische

unread,
May 17, 2013, 8:34:45 AM5/17/13
to us...@couchdb.apache.org, Chris Costakes
Hi Chris,

you currently can't query for another attribute. You could also try a
_list function [1], it would then be handled on the server side and not
transfer all the data to the client side.

[1] https://couchdb.readthedocs.org/en/latest/ddocs.html#list-functions

Cheers,
Volker

Chris Costakes

unread,
May 17, 2013, 4:21:34 PM5/17/13
to Volker Mische, us...@couchdb.apache.org
Not transferring the data to the client would definitely help quite a bit.
I haven't used list functions before but will give it a try.
Thank you!
Reply all
Reply to author
Forward
0 new messages