firebase / firebase/geofire-js
Geofire querying data totally out of range for radius zero
- Dominant language
- TypeScript
- Stars
- 1.4k
- Forks
- 339
- PR merge metrics
- No merged PRs in 30d
Description
### 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](https://firebase.google.com/docs/firestore/solutions/geoqueries) 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.
Contributor guide
Research direction
Start by reproducing the issue with geofire.geohashQueryBounds(center, 0), following the linked Firebase Firestore geoquery documentation. Compare the returned bounds and queried documents with a slightly positive radius. Done means a zero-radius query no longer returns documents outside the requested center point.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100