Closed s3bok closed 3 years ago
Even i m facing same issue. GeoFlutterFire works perfectly with location/nearby results but as soon as where condition is added, it stops working.
Second that, hoping someone here has a fix as this otherwise would be quite wasteful calculating all distances to then remove 70% of the results after being loaded.
I decided don't to use the library and I do a query with Geohash, you can use this reference https://www.movable-type.co.uk/scripts/geohash.html
First with Firestore I have the geopoint with geohash, so I do a query using start at "gbsuv", the results depends of Geohash length, like can you see in the web page, for example I use 5 characters that returns alls around 4.89km.
And I cant use where clause, whitout forget create the index in Firestore.
Sorry for my English friends.
I decided don't to use the library and I do a query with Geohash, you can use this reference https://www.movable-type.co.uk/scripts/geohash.html
First with Firestore I have the geopoint with geohash, so I do a query using start at "gbsuv", the results depends of Geohash length, like can you see in the web page, for example I use 5 characters that returns alls around 4.89km.
And I cant use where clause, whitout forget create the index in Firestore.
Sorry for my English friends.
Yes, even i m not using this library now. But can you please tell how to use start at with a String saved having geoHash?
Yes, even i m not using this library now. But can you please tell how to use start at with a String saved having geoHash?
I'm doing with geohash in firebase.
This is my query, I'm using where for filters, that for me is more easy use an array and an index
db.collection('company').orderBy('companyPosition.geohash').startAt('gbsuv').endAt('gbsuv' + '\uf8ff') .where('filters', 'array-contains-any', ['My_Company','Type']).get().then(res => {...
So it is not possible to add a where condition? I got a link to create the index, but that didn't help either...
So it is not possible to add a where condition? I got a link to create the index, but that didn't help either...
I tried to add a where condition with index but for me that was imposible... so i done the query with geohash and for now it works, for me it's ok because I'm going to change the database after if is necesary
I can confirm that .where is not working. I've tried many things but i get null return when adding .where to my collectionreference... I have created index ect... I can also see that the code for this is outcommented in the Flutter/dart package example, so developer must be aware of the problem.
I would really much like to use query with .where - any plan on solving this issue soon ?
Thanks for a great package! /Jan
I can confirm that .where is not working. I've tried many things but i get null return when adding .where to my collectionreference... I have created index ect... I can also see that the code for this is outcommented in the Flutter/dart package example, so developer must be aware of the problem.
I would really much like to use query with .where - any plan on solving this issue soon ?
Did you try with geohash ? I did some queries with where and it works fine... can you share your query example to see if I can helpyou ?
Hi @s3bok I've updated to new Flutter 1.20.2 and also Firebase Core 0.5.0 and now it is working when I include .where in the collection 👍 I could be that my index in firestore was wrong as I also created a new for the query, but anyway, thanks for helping.
Hi @s3bok I've updated to new Flutter 1.20.2 and also Firebase Core 0.5.0 and now it is working when I include .where in the collection 👍 I could be that my index in firestore was wrong as I also created a new for the query, but anyway, thanks for helping.
Excellent, I'm goint to try that.
I need a query that includes an order by date and by geolocation, is this possible? someone help me? Thx!
I need a query that includes an order by date and by geolocation, is this possible? someone help me? Thx!
If you are using the library, I believe that it orders by position you need test that... about order by date you can use in your collection the order by:
Firestore.instance
.collection('YOUR-COllection')
.orderBy('createdAt', descending: true or false).getDocuments()
However, I decided not use le library and create the query using geoHash, if you need help you can share your query...
sorry the English isn't my first language, I'm from Mexico
I faced the same issue, but nothing is wrong with library, just add composite index to firestore,like position.geohash
in ascending order , because it orders by geohash here in this function of library.
/// construct a query for the [geoHash] and [field]
Query _queryPoint(String geoHash, String field) {
final end = '$geoHash~';
final temp = _collectionReference;
return temp.orderBy('$field.geohash').startAt([geoHash]).endAt([end]);
}
Wrapping the entire thing in try catch worked for me (print the error and you'll get the link to build the index automatically )
You need to add the index in firebase for it to work, you can add the .onError validation in the streambuilder and get the link to make the index automatically.
Yes, even i m not using this library now. But can you please tell how to use start at with a String saved having geoHash?
I'm doing with geohash in firebase.
This is my query, I'm using where for filters, that for me is more easy use an array and an index
db.collection('company').orderBy('companyPosition.geohash').startAt('gbsuv').endAt('gbsuv' + '\uf8ff') .where('filters', 'array-contains-any', ['My_Company','Type']).get().then(res => {...
I'm having a document where i store users age , name , location (lat,long,geohash). What i want is find whether they are within in the radius is it possible ? and i need to show next set of user details (paginate) when user scroll @s3bok
I need to do a query, first I tried with group by and after with Where, I did a index in FireStore, but the query return all matches with position... (i read the issues here, but the last was since one year) With startAt
With Where
I have the Inex in FireStore