-
Notifications
You must be signed in to change notification settings - Fork 58
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
ref.limit() not working for updateCriteria() #26
Comments
@MvRemmerden this may be an issue specific to Firestore, however I also think this may be an issue in how queries work. The geofirestore (and geofire) package wraps/scans hashes around the hash of what/where you select. That way if you're point is by the borderline of where a hash could be we don't miss areas right outside of the query. So if we're doing multiple queries in order to ensure that we have the full area covered then we will hit the I think in order to really fix this, the way queries are made will have to be completely rewritten... And still won't be perfect. Generally speaking, I don't think it can be done with a geohash strategy to queries... But I can give it a look/think... (Like how would the limit work if we're listening to changes?! Really unsure how to approach this) |
Very interesting, I will have to dive deeper into how the entire process works to actually help for a long-term solution. For a quick fix, the easiest way might be to take the final array and remove items until we arrive at the number provided in the limit() method (or loop over the items and remove the ones furthest away from the center). That way the results would actually match the number that is expected. |
Additional problem that I'd appreciate your thought on. So, while I may be able to do a limit on the first/initial query (which will slow down the query a little bit). The |
Good question. I think in most use cases there is a huge difference between what the data from the Example: Searching for a place on Booking.com or Airbnb where you can display places to stay on a map. The only time the results get updated is when you move the map manually, and that's what updateCriteria is for. In this case it makes sense to return the initial query with the limit as not to create information overload. And most other use cases I can imagine where |
What you're describing as use cases makes sense, but it really takes away from the intended use case of this library (which is effectively to bring (As a note I checked, I wouldn't be able to get the limit value that you would use in your query function, so I wouldn't be able to manually limit it on my end) |
I certainly get that. As soon as I'm finished with my project, I can publish the source code and the workarounds I built to get these use cases to work. In some situations, it might not hurt to provide some additional data (as for the initial data in the |
So I won't be "fixing" this, but I will make a note in the documentation about this issue for users moving forward. I will be closing this for now. |
Whenever I use ref.limit(x) in updateCriteria(), the actual maximum number of places returned is x+1.
The text was updated successfully, but these errors were encountered: