Geosearch Search API GAE filtering distance(geopoint(MY_GEOPOINT), store_location) < DISTANCE queries

147 Views Asked by At

I in doubt about how the Search API makes the queries, especially how it scans the Documents in the Index. My doubt is the following:

I have an Index with a lot of Documents with GeoPoints on it. I want to list the points that are in an specific radius. For example, if I have 20 millions Documents in the Index and do a search like this one:

String query = distance(geopoint(MY_GEOPOINT), store_location) < 10000

It will list the stores that are on the radius of 10 km.

My question is the following: How Search API are going to do it? will it scans the 20 millions of documents(and take a long time) or it will optimize in some way?

I questioning because of performance, I am developing an app that will use GeoSearch and I'm afraid it with get slowly as the database grows.

Thanks for any help. Kind Regards JLuiZ20

1

There are 1 best solutions below

0
Zig Mandel On

it will certainly not scan all records. you can infer this from the documentation in https://cloud.google.com/appengine/training/fts_adv/

Because geopoint is a supported data type and has the distance built-in function and supports geospatial queries, it can efficiently index geopoints in a way that it can query on a radius from a point. appengine docs don't mention the algorithm used, there are many such algorithms that it could be using but you bet its efficient, otherwise it wouldnt be a supported type.