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

Feature request: search(bbox, dataString) #76

Closed
maja42 opened this issue Jun 2, 2017 · 1 comment
Closed

Feature request: search(bbox, dataString) #76

maja42 opened this issue Jun 2, 2017 · 1 comment

Comments

@maja42
Copy link

maja42 commented Jun 2, 2017

The entries/nodes I store in RBush have many properties, including an 'id' field.
When performing a search-query, I only need a list of ids, rather than a list of entries.

To do so, I currently use the map function:

var entries = tree.search(bbox);
var ids = entries.map(function(val) {
    return val.id;
});

For my specific case, it would be nice if RBush could offer this functionality for me, so that I don't need to convert the result myself anymore. (Note: changing the result.push(child); into an result.push(child.id); in rbush's search method does the trick.)

To do this, the search-function could take a second, optional parameter where I can pass the string ".id". This would work similar to the constructor method that accepts a format (and which is awesome!).

However, I'm not sure if there is enough demand for this feature and if it makes sense to put it into RBush.

@maja42 maja42 changed the title Feature request: searchMap() Feature request: search(bbox, dataString) Jun 2, 2017
@mourner
Copy link
Owner

mourner commented Jun 2, 2017

Thanks for the suggestion! However, I don't think it's worth complicating the API with additional options if you can simply call entries.map(p => p.id), which is simple and straightforward.

@mourner mourner closed this as completed Jun 2, 2017
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