0

I'd like to query my data with a query that will return me everything on a radius (geofire can find that alright) but also within a datetime window.

At the moment I'm storing datetimes as priorities, so it's quite easy to query the array asking for data between 2 priority numbers (corresponding to start/end datetimes).

It's also quite easy to put my data in a GeoFire array and then query it to get the radius.

Can I combine those 2 though? In an easy not too hacky way?

Cheers

STE
  • 656
  • 3
  • 8
  • 18
  • There is a single .priority for every node. If you can find a way to combine your datetime and the geohashes into a single .priority, you can query on their combination. But it sounds unlikely that in your use-case you can combine the two. – Frank van Puffelen Sep 20 '14 at 10:52

1 Answers1

2

Not with a single query. You must either filter client side, or do your query in more than one phase.

This is because:

The easiest way to deal with this is to do additional filtering client side. If the bandwidth impact starts causing issues, partition your data (e.g. group events by month) and do it in multiple phases.

mimming
  • 13,974
  • 3
  • 45
  • 74
  • Hey Jenny thanks for your answer. I see that startWith takes both name and priority as arguments. Does this mean I could use those as primary and secondary indexes and thus do a query based on both of them? For example name them with their timetamp and prioritise them with their geohash -> then use startWith(sometimestamp, somegeohash) etc – STE Oct 01 '14 at 00:28
  • 1
    Yup, I guess you could. The only caveat might be that priority isn't guaranteed to be unique. – mimming Oct 01 '14 at 02:50
  • Thanks :) If you'd like to add it to your answer, I can accept it as answer to my question – STE Oct 10 '14 at 23:58