Inversed geo search

Is it possible to have some kind of ‘inversed geosearch’ nativly?

Let me explain. Usually, when it comes to geosearch, I do this : finding all points inside a defined circle.

But for a special purpose, I need to do the opposite : finding all circles that contains the defined location.

(ie: I’ll have 3 results here)

Algolia cannot perform this kind of search out of the box. I can think of a workaround if special criteria are met:

  • Only circles are involved (not arbitrary geometric shapes).
  • You know the maximum radius of the circles.

Then you can do a geo search for circle whose centers are within a radius from the current location equal to the maximum radius of the circles; then filter the results that are actually farther than their own radius (meaning they don’t contain the current location). This second step is based on a dynamic criterion (the radius of each potential match) so it must be done as a post-processing on your side.

While this might work, it is rather convoluted, and potentially inefficient if the maximum radius is huge. For this kind of use case, I would recommend using a specialized geo database. :slight_smile: