Git Product home page Git Product logo

Comments (19)

yevgeniaronov avatar yevgeniaronov commented on May 27, 2024 2

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.

mike-gallego avatar mike-gallego commented on May 27, 2024 1

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.

DarshanGowda0 avatar DarshanGowda0 commented on May 27, 2024 1

@mikeyyg96 .where() works only with isEqualTo at the moment. And also are you creating index the first time?

from geoflutterfire.

Moellendorff avatar Moellendorff commented on May 27, 2024 1

Same issue as rmelian's. Like rmelian, I never get the link to create the composite index.

from geoflutterfire.

Moellendorff avatar Moellendorff commented on May 27, 2024 1

@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.

 avatar commented on May 27, 2024 1

@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.

japborst avatar japborst commented on May 27, 2024

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.

momoDragon avatar momoDragon commented on May 27, 2024

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.

DarshanGowda0 avatar DarshanGowda0 commented on May 27, 2024

@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.

mike-gallego avatar mike-gallego commented on May 27, 2024

@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.
Screenshot_20190501-153146__01

from geoflutterfire.

momoDragon avatar momoDragon commented on May 27, 2024

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.

momoDragon avatar momoDragon commented on May 27, 2024

@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.
Screenshot_20190501-153146__01

Check your console. it would prompt u to create index. there will be a link. just click it

from geoflutterfire.

mike-gallego avatar mike-gallego commented on May 27, 2024

@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.

momoDragon avatar momoDragon commented on May 27, 2024

@mikeyyg96 yup. I always use strict mode

from geoflutterfire.

DarshanGowda0 avatar DarshanGowda0 commented on May 27, 2024

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.

rmelian avatar rmelian commented on May 27, 2024

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
image
image
Am I missing something here?

from geoflutterfire.

momoDragon avatar momoDragon commented on May 27, 2024

@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
Screenshot 2020-01-01 at 11 27 08 AM

from geoflutterfire.

atnegrete avatar atnegrete commented on May 27, 2024

@momoDragon So position.geohash must be the last field when setting up the index?

Update - That did not work for me either

from geoflutterfire.

smolugu avatar smolugu commented on May 27, 2024

query still not working after creating composite index. did anyone find a solution for this? Thank you!

from geoflutterfire.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.