Skip to content

Documentation: equal keys in "range" #4

@shaunc

Description

@shaunc

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions