-
Notifications
You must be signed in to change notification settings - Fork 15
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
nearest_n_within
does not limit the number of items when not sorted
#168
Comments
Whoops! Thanks for spotting this. Will fix in an upcoming release as soon as I can. |
@ezrasingh , you can always use the git repo instead of a released crate:
|
Hey @Nahor, I pinned Kiddo to that revision in my crate, but my unit tests are still failing. Initially, I thought it might be due to stale code on my machine. However, the tests also failed in CI. Could this possibly be a regression? |
I just submitted a PR (#180) to validate the consistency of the behavior when This difference explains why pinning Kiddo did not work for my case. While I can work around this with a conditional branch, I don't believe this inconsistent behavior is intended. If it works with sorted results, it should also work with unsorted results, ensuring consistent handling of |
Hey all - just released v4.2.1: https://crates.io/crates/kiddo/4.2.1 |
Aah hey Ezra, I'll take a look over this weekend and see if I can get a fix out. |
This issue should be resolved in #186 as part of the rewrite of the https://crates.io/crates/kiddo/5.0.0 I know this issue was raised a while ago, and you have probably moved on, but if you do get chance to try v5 I'd love to hear any feedback. I'm closing this issue. |
In kiddo
v4.2.0
,nearest_n_within
will only limit the number of items if sorting is enabled. If it's disabled, all the items within the radius are returned.E.g. in the
cities
example, replacenearest_n
withnearest_n_within
and a radius of 10km.This outputs 13 cities (for my data set) instead of the expected 5. If the list is sorted, then it works as expected.
Also note that the example in the documentation for
nearest_n_within
creates a tree of 2 items, asks for 2 items, and then is happy because it got 2 items in return!The text was updated successfully, but these errors were encountered: