Geo indexes can only be used by calling geo functions that utilize them (NEAR, WITHIN, WITHIN_RECTANGLE). These functions return documents in an array, sorted by distance (closest distance first). It's currently not possible to add additional filter criteria while still using the geo index, also see Geo Location / Index Intersection <https://github.com/arangodb/arangodb/issues/1700>.
Regarding the limit of NEAR: You could pass a very high value here to retrieve all documents, although that's probably not a smart thing to do with millions of documents in the collection. The array of documents is returned as a whole and needs to fit into main memory. Getting documents in batches out of the geo index is not not possible at the moment I'm afraid. If you don't actually need all documents, you may find WITHIN and WITHIN_RECTANGLE more useful than NEAR, as you can define the maximum distance between the search coordinate and the locations stored in the documents / the area the locations must be in. In your particular case, a function to calculate the distance between two arbitrary coordinates could be the best solution, as you would be able to SORT DISTANCE(lat1, lon1, lat2, lon2) using your first query. See https://github.com/arangodb/arangodb/issues/1846 -- You received this message because you are subscribed to the Google Groups "ArangoDB" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
