metteo / geomodel

0 stars 0 forks source link

Allow paging for proximity queries #3

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Currently, proximity queries return one result set and are finished--no 
paging can be done. There needs to be a way to progressively ask for more 
results.

One idea is to have a 'minimum distance' parameter to proximity_query so 
that the query for 'page 2' can use a minimum distance slightly smaller 
than the distance of the last page 1 result.

Original issue reported on code.google.com by api.roman.public@gmail.com on 27 Apr 2009 at 6:42

GoogleCodeExporter commented 9 years ago

Original comment by api.roman.public@gmail.com on 6 Jun 2009 at 9:03

GoogleCodeExporter commented 9 years ago
Now that cursors have been added to App Engine, could these be incorporated to 
handle
paging?

Original comment by ghi...@gmail.com on 18 Feb 2010 at 8:17

GoogleCodeExporter commented 9 years ago
Sounds like it! Unfortunately I don't have any time to work on this; if someone 
was 
interested in implementing this and submitting a patch, I'd gladly take a look 
:-)

Original comment by api.roman.public@gmail.com on 24 Feb 2010 at 2:17

GoogleCodeExporter commented 9 years ago
I've actually implemented this in my own version of geomodel. It's a bit hacky 
and I think it'll need a bit of work before really committing it.

The problem is that geomodel uses the IN query to do proximity searches, which 
do not support cursors. When doing a geo search, geomodel builds an array of 
geo location hashes and then returns all entities within that array. What makes 
paging difficult is that the IN query does not support cursors, which are 
essential for paging. I've sort of solved this part of the problem, you can 
take a look at my code here: 
http://code.google.com/p/gae-multiquery-with-cursor/

However, even with that you need to do a bit of hacking within the geomodel api 
itself. I'd be happy to share my code if there was an interest.

Original comment by michael....@gmail.com on 12 Jun 2011 at 5:56

GoogleCodeExporter commented 9 years ago
One more thing... even with my solution, ordering does not work. So you won't 
be able to do a geo search and then order on some value. This is a limitation 
of the current GAE system and I doubt there's a scalable solution (you can 
always order in memory though).

Original comment by michael....@gmail.com on 12 Jun 2011 at 5:58