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

Documentation: equal keys in "range" #4

Open
shaunc opened this issue Oct 14, 2018 · 0 comments
Open

Documentation: equal keys in "range" #4

shaunc opened this issue Oct 14, 2018 · 0 comments

Comments

@shaunc
Copy link

shaunc commented Oct 14, 2018

Thanks for the library. It would be great to document what happens in the case of equal keys (by the comparator function).

I want to store (numerical) ranges, and be able to search for all items whose range is overlapping. (In fact, the items indexed have disjoint ranges, but the search range may have start and end overlapping several.) My idea was to have a comparator that took a range as a key, and returned 0 for overlapping ranges, but otherwise ordered by start of range. With a quick test, it seems to work, but the documentation doesn't guarantee that it will work. Also "find" does seem non-deterministic when it comes to retrieving items with equal keys.

UPDATE
In fact, doesn't always seem to return all nodes in range if there are several equal. (Is this a bug?) Switched to querying for range [start,start] -> [end,end] to get elements overlapping range [start, end]. This seems to work (given indexed items are disjoint). In any case, documentation would be welcome.

@shaunc shaunc changed the title Documentation: equal keys Documentation: equal keys in "range" Oct 15, 2018
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

1 participant