Comments (19)
Also upvoting this. I am not getting the prompt with the link to create the composite index. Without it, it is returning data but ignoring the composite query (where clauses).
from geoflutterfire.
ok the problem for me has been solved for me.
apparently the solution was not
collectionRef: query.reference()
as stated by @stevenspiel
The solution was to manually create an index on firebase console.
usually when using the standard cloud firestore plugin, it would prompt you with a link to automatically make the index if needed. But in this case with this package, the message wasn't passed.
The solution to manually create the index.
more info on the solution is here:
#29
@DarshanGowda0
Take note that there was no prompt to create index given as stated that it should have on your documentation
https://pub.dev/packages/geoflutterfire
from geoflutterfire.
Did any of you manage to succeed using arrayContains or arrayContainsAny in combination with GeoFlutterFire and appropriate composite index?
from geoflutterfire.
@stevenspiel are you sure
collectionRef: query.reference()
is working?
because it's returning all the results because the .where() is being ignored
from geoflutterfire.
@momoDragon About to try this right now. No matter what I did, I can't get the error with the link to create the index on the console. I even wrapped it all with a try-catch and nothing!
from geoflutterfire.
@atnegrete I am facing the same issue as you. My where clause is being ignored when using
collectionRef: query.reference()
which results in returning everything
@DarshanGowda0 can you please take a look into the issue? where clause was working perfectly fine back in the days but not it seems to be giving issues now
from geoflutterfire.
@The24HourClock I think there is a conflict in the name of the field (event-category) in the query and index that you have created. There is '-' in the field name but in index there isn't and also 'c' is Capital in index.
from geoflutterfire.
I've also been running into this.
from geoflutterfire.
This worked for me as soon as I called .reference()
on the query to return a DocumentReference.
So, in theory, this should work for you:
var query = Firestore.instance.collection('seekers').where('position', isEqualTo: 'none');
var snap = await _geo
.collection(collectionRef: query.reference())
.within(center: _geo.point(latitude: lat, longitude: lon), radius: locationRadius, field: location', strictMode: false)
.first;
return snap;
from geoflutterfire.
@stevenspiel It looks like the order of the keys in the composite index is important (location.geohash must be last in the list?) I managed to do it without .reference().
from geoflutterfire.
@rolznz Can you please explain how you managed to do this ? Thanks
from geoflutterfire.
@atnegrete i don't think its an error. it's a prompt to create the index. that is why a try-catch won't be executed because it is not an error. The prompt is from the cloud firestore plugin and not from the geoflutterfire probably the prompt is not being passed from the cloudfirestore plugin to the geoflutterfire fire plugin, hence we do no get the prompt being shown.
from geoflutterfire.
Interesting!
Things are somewhat working as expected manually creating that index. I have noticed that I do not get updates instantly, flipping the "strict mode" flag true/false will cause it to fetch the newer values. Probably a different issue altogether, maybe due to converting that stream into a Future (first) and something keeping the values cached on that stream?
from geoflutterfire.
I have created a composite index but for some weird reason it isn't working.
Composite Index
My composite Index
Stream
queryStream = queryRadius.switchMap((rad) {
var collectionReference = _firestore.collection('Broadcasts').where('event-category', isEqualTo: 'Entertainment');
var stream = geo.collection(collectionRef: collectionReference).within(center: center, radius: rad, field: 'position', strictMode: true);
return stream;
}
Am I doing something wrong?
from geoflutterfire.
Did any of you manage to succeed using arrayContains or arrayContainsAny in combination with GeoFlutterFire and appropriate composite index?
I'm highly interested to know if it is possible or not. I'm currently trying to get result with an arrayContainsAny but cannot get anything.
Ok sorry it is solved for me. My index was incorrect. It is working fine now.
from geoflutterfire.
Wrapping the entire thing in try catch worked for me (print the error and you'll get the link to build the index automatically )
from geoflutterfire.
This issue is still there and quite annoying. If you have complex queries, it is a pain to build all indexes manually.
@DarshanGowda0, is there not a way to pass Cloud console message properly through library?
anyone having a clue?
from geoflutterfire.
@Bader-Al how did you manage to get output? If I put try catch as follow I don't get anything:
var query = Firestore.instance.collection('seekers').where('position', isEqualTo: 'none');
try {
var snap = await _geo
.collection(collectionRef: query)
.within(center: _geo.point(latitude: lat, longitude: lon), radius: locationRadius, field: 'location', strictMode: false);
} catch (e) {...}
I have a more complicated query, therefore I would like to see the index that I need to create as I'm not managing to make it work.
from geoflutterfire.
hey i cant get .where and limit results...?????
any luck anyone??
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.