Open itismejy opened 4 months ago
@itismejy
how many documents are queried maximum?
Do you want to ask how many documents are retrieved at maximum as geoflutterfire_plus queries?
The maxim number is not set by geoflutterfire_plus package, but for now you can't set orderBy
to your query, so even if you set limit
to your query, it might not work as you expect.
Hi there, I was wondering if this is possible?
https://stackoverflow.com/questions/62175796/limit-the-retrieve-of-documents-from-firebase-on-flutter Query query = cities.orderBy("name").limit(3); // descending order
Query query = cities.whereGreaterThan("population", 2500000L).orderBy("population").limit(2); // ascending order
In your code for geoflutterfire_plus, i see this:
@visibleForTesting
Query
I see you are doing the query with cloud firestore https://firebase.google.com/docs/firestore/query-data/order-limit-data#dart in their docs they do this: final citiesRef = db.collection("cities"); citiesRef.orderBy("name").limit(3);
Could the query be changed to: query.where('$field.$geohashField', isGreaterThan: geohash, .orderBy('$field.$geohashField').limit(5); // add the limit here, and alllow user to pass it as a parameter
@itismejy
It is possible to add .limit(N)
to your query, and it certainly returns N
or less documents.
However, you can't set orderBy
to your query, so the result might not work as you expect in terms of its order (it is not possible to get to know which N
documents are retrieved from the query).
Maybe we could change the docs of this page. It says
🚨 Limitation: currently limit and orderBy queries are not supported because of the geo hash query algorithm and Cloud Firestore query limitations. Alternatively documents can be sorted on client side after getting the data (documents).
After reading this thread it makes sense, but on my first read I thought that limit-queries (without orderBy) aren't supported either.
@bw-flagship
Thank you! I'll think about updating README to avoid confusion!
In the documentation:
🚨 Limitation: currently limit and orderBy queries are not supported because of the geo hash query algorithm and Cloud Firestore query limitations. Alternatively documents can be sorted on client side after getting the data (documents).
I would like to ask, how many documents are queried maximum?