Testing the library: when querying a collection that contains 20 documents, the query returns the expected results.
However, in case of big collections (>10k documents), the query is not returning the expected results.
For example, I have around 30 documents within the radius of 1 km, and around 10000 documents outside such a radius. When querying documents within a radius of 1 km and a limit of 30 documents:
the first 28 results have a distance of 900 m - 10 km, and the remaining 2 have a distance of 129.5 km.
90% of the documents within radius of 1 km are not returned unfortunately.
If I remove the limit, the query returns 1100 documents... Of course most of them are well outside the radius.
For information, I inserted the geoFireLocation field in each document via Javascript, using the formula:
degreeMatch = (latitude+90)*180 + longitude;
Testing the library: when querying a collection that contains 20 documents, the query returns the expected results. However, in case of big collections (>10k documents), the query is not returning the expected results. For example, I have around 30 documents within the radius of 1 km, and around 10000 documents outside such a radius. When querying documents within a radius of 1 km and a limit of 30 documents:
the first 28 results have a distance of 900 m - 10 km, and the remaining 2 have a distance of 129.5 km. 90% of the documents within radius of 1 km are not returned unfortunately.
If I remove the limit, the query returns 1100 documents... Of course most of them are well outside the radius. For information, I inserted the geoFireLocation field in each document via Javascript, using the formula:
degreeMatch = (latitude+90)*180 + longitude;