firebase/geofire-js

Geofire querying data totally out of range for radius zero

Opened this issue · 0 comments

Version info

Firebase: V8 Modular (using cloud functions)

GeoFire: V6.0.0

Test case

If you try to query documents around [pointLatitude, pointLongitude] with radiusInM = 0 the query returns unexpected documents totally out of range(and not because of Geohashing approximations).

The radiusInM = 0 may happen if you're querying inside a loop, which is not so uncommon.

Steps to reproduce

Use geofire.geohashQueryBounds(center, radiusInM) as specified in the Firebase documentation for Firestore and assign radiusInM = 0.

Expected behavior

Would return the documents within the given radius around a center point [pointLatitude, pointLongitude].

Actual behavior

Returns many other documents completely out of range and may result in high costs depending on your application.
If you have documents around the given center but away from the radius, the query may still return them.

If I query for the same center but with a slightly bigger radius the query works.