Comments (19)
i have sort of the same issue:
var collectionRef = Firestore.instance.collection('/user_data').where('gender', isEqualTo: 'male');
return geo .collection(collectionRef: collectionRef.reference()) .within(center: center, radius: 1, field: 'location');
it totally ignores the .where, and just outputs all users within the radius.
from geoflutterfire.
I'm surprised you got a read at all. I tried filtering my collection with a where clause and it seemed to have not work. I checked multiple times to see if it is right collection, field, and value and they were all correct, but still no read. When I would take the where clause out, all the records come through.
from geoflutterfire.
@mikeyyg96 .where()
works only with isEqualTo
at the moment. And also are you creating index the first time?
from geoflutterfire.
Same issue as rmelian's. Like rmelian, I never get the link to create the composite index.
from geoflutterfire.
@rmelian Solved by manually creating an index that, in your terms, would be:
Collection ID: itineraries
Field indexed: status Ascending position.geohash Ascending
Query scope: Collection
from geoflutterfire.
@rmelian Solved by manually creating an index that, in your terms, would be:
Collection ID: itineraries
Field indexed: status Ascending position.geohash Ascending
Query scope: Collection
is need sequins as where conditions and then position.geohash index look like status_position.geohash
from geoflutterfire.
I believe each .where()
is basically an OR
statement that is being merged when they arrive, so it kinda makes sense that it results in multiple reads.
from geoflutterfire.
Not possible to incorporate .where() when doing the geoquery rather than do it after the query? Because without its, its not very flexible for doing querys hence causing extra unnecessary doc reads
from geoflutterfire.
@momoDragon .where()
is supposed to just give you 1 read, I'm sure this has been the case from the first version when used with isEqualTo
, it uses the same query as cloud_firestore. Could you verify again?
from geoflutterfire.
@DarshanGowda0 Yeah I used the exact format in the documentation:
var queryRef = _firestore.collection('locations').where('city', isEqualTo: 'bangalore');
but with my values:
var queryRef = _firestore.collection('events').where('category', isEqualTo: 'activities');
I have this field in my collection and that value as well but nothing returns. When I take out the where clause, the record pops up. It is only 1 record in my collection.
from geoflutterfire.
Yes i have tested. and ya. its quite bad. its causing me hell alot of reads man. @DarshanGowda0 u need to try it again man. Open a new project and use app engine to track the usage.
from geoflutterfire.
@DarshanGowda0 Yeah I used the exact format in the documentation:
var queryRef = _firestore.collection('locations').where('city', isEqualTo: 'bangalore');
but with my values:
var queryRef = _firestore.collection('events').where('category', isEqualTo: 'activities');
I have this field in my collection and that value as well but nothing returns. When I take out the where clause, the record pops up. It is only 1 record in my collection.
Check your console. it would prompt u to create index. there will be a link. just click it
from geoflutterfire.
@momoDragon Can you please show me where that link is located or what exactly is it saying? I have a lot of information in my console and it keeps updating and filtering the console with vscode sucks.
Edit: BTW, did you try strictMode: true
? Maybe that'll help.
from geoflutterfire.
@mikeyyg96 yup. I always use strict mode
from geoflutterfire.
Hey @momoDragon! I verified this again, the number of reads is always 1 if I have just one document that satisfies the where()
condition. The firestore query you pass is the first condition that is executed and geofire filtering happens after the where()
filter is done (check this).
from geoflutterfire.
I have sort of a similar issue. When I use a where clause the stream never returns back:
var query = Firestore.instance
.collection('itineraries')
.where('status', isEqualTo: status.toString());
GeoFirePoint center =
geo.point(latitude: nearby.latitude, longitude: nearby.longitude);
double radius = 50;
String field = 'position';
Stream<List<DocumentSnapshot>> stream = geo
.collection(collectionRef: query)
.within(center: center, radius: radius, field: field);
List<DocumentSnapshot> docs = await stream.first;
if I remove the where it works fine. I have created the composite index in different ways manually as I never get the link to create it
Am I missing something here?
from geoflutterfire.
@atozbtcom and @Moellendorff are right. I just verified that.
@yevgeniaronov u need to manually set indexing in firebase console.
ensure that u sort the where clause field first before the position.geohash
from geoflutterfire.
@momoDragon So position.geohash must be the last field when setting up the index?
Update - That did not work for me either
from geoflutterfire.
query still not working after creating composite index. did anyone find a solution for this? Thank you!
from geoflutterfire.
Related Issues (20)
- Poorly worded/located documentation for using a where statement HOT 1
- Stream doesn't update properly HOT 1
- GoogleMapController Initialization
- in the fact this package get all docs in Firstore , either it meat radius or not !! horrible read me list , not true HOT 1
- near places not meet redious
- How to sort in order of closest? HOT 2
- How to apply geoCollection.within for polygons
- Update dependency to: flutter_lints ^2.0.1 HOT 4
- Not compiling after 3.0.0 when receiving query
- geoflutterfire stopped working with Google IO Firebase plugin updates in pubspec.yaml HOT 1
- Centered on same set of data locations, Query result succeeds or fails depending of the radius
- Getting error on calling GeoFirePoint.data HOT 1
- Empty result when querying "within" on collection HOT 6
- It simple stop working
- Additional Maintainers HOT 4
- Please update flutter_lints pakage to new version or remove from geoflutterfire HOT 4
- cloud_firestore: ^4.0.2 - compatibility HOT 7
- Cloud Call Error when querying documents through GeoFlutterFire
- Example: Could we replace BehaviorSubject with Dart StreamController?
- geoflutterfire >=3.0.2 depends on cloud_firestore ^3.1.6, but I have cloud_firestore ^4.4.4. I have to downgrade to make it work? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geoflutterfire.