Skip to content
New issue

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

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

Already on GitHub? # to your account

[Question] Nearby filter #280

Closed
sweco-semtne opened this issue Mar 8, 2018 · 4 comments
Closed

[Question] Nearby filter #280

sweco-semtne opened this issue Mar 8, 2018 · 4 comments

Comments

@sweco-semtne
Copy link

sweco-semtne commented Mar 8, 2018

Hi,
I'm trying to understand the nearby / knn function.
Is it possible to provide a filter similar to the rbush knn filter function?

knn(tree, x, y, [k, filterFn, maxDistance])

tree: an RBush tree
x, y: query coordinates
k: number of neighbors to search for (Infinity by default)
filterFn: optional filter function; k nearest items where filterFn(item) === true will be returned.
maxDistance (optional): maximum distance between neighbors and the query coordinates (Infinity by default)

Basically I have properties on the objects and I would like the NEARBY to give me the n closest with a given property.
I'm thinking that MATCH is used after the KNN has obtained the result?

Thanks for a great product btw!

@tidwall
Copy link
Owner

tidwall commented Mar 8, 2018

Interesting. This sounds like something that needs to be fixed and similar to #199.

@tidwall
Copy link
Owner

tidwall commented Mar 10, 2018

I just pushed a fix to the master branch.

@sweco-semtne
Copy link
Author

Thanks! I’ll try it out. And once again, fantastic work!

@tidwall
Copy link
Owner

tidwall commented Mar 10, 2018

You’re welcome and thanks for the kind words. :)

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

No branches or pull requests

2 participants