Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QueryBuilder not returning any results #188

Closed
stefandric opened this issue May 8, 2024 · 2 comments
Closed

QueryBuilder not returning any results #188

stefandric opened this issue May 8, 2024 · 2 comments

Comments

@stefandric
Copy link

stefandric commented May 8, 2024

geoflutterfire_plus: ^0.0.21

When trying to inject additional query, I am not getting any results. When removing queryBuilder, I am getting all results.

Code:

var res =
      await GeoCollectionReference<Map<String, dynamic>>(collectionReference)
          .subscribeWithin(
            center: center,
            radiusInKm: radiusInKm,
            field: field,
            geopointFrom: geopointFrom,
            queryBuilder: (query) => query.where('archived', isEqualTo: false),
          )
          .first;

  final obj =
      res.map((docSnapshot) => Post.fromDocumentSnapshot(docSnapshot)).toList();

  return obj;

nor with fetchWithin

var res =
      await GeoCollectionReference<Map<String, dynamic>>(collectionReference)
          .fetchWithin(
    center: center,
    radiusInKm: radiusInKm,
    field: field,
    geopointFrom: geopointFrom,
    queryBuilder: (query) => query.where('archived', isEqualTo: false),
  );

i've tested it further because i thought it is something with my query, but passing null to query doesn't also work(I saw an example proj where null should get all values as well).

var res =
      await GeoCollectionReference<Map<String, dynamic>>(collectionReference)
          .fetchWithin(
    center: center,
    radiusInKm: radiusInKm,
    field: field,
    geopointFrom: geopointFrom,
    queryBuilder: (query) => null,
  );
@stefandric
Copy link
Author

@kosukesaigusa any update on this?

@kosukesaigusa
Copy link
Owner

@stefandric

Thank you for your comment and, sorry for my late reply!

May I ask you you have set necessary index on Cloud Firestore to execute the query?

https://github.com/kosukesaigusa/geoflutterfire_plus?tab=readme-ov-file#custom-query-conditions

000038@2x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants