JanusGraph / JanusGraph/janusgraph
range(low, high) doesn't work with mixed index
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 5.8k
- Forks
- 1.2k
- Avg merge
- 13h 53m
- Merged PRs (30d)
- 6
Description
Following on #252, it has been noted that `order().by(property).range(low, high)` does not take advantage of the mixed index. @davidclement90 [noted](https://github.com/JanusGraph/janusgraph/issues/252#issuecomment-353629881):
> IndexQuery do not support offset. So it just support ranging with no offset range(0,10). Range with offset will be do in-memory with the high range as query limit. https://github.com/JanusGraph/janusgraph/blob/a127060de7125a94261cc313697ce778ac7ec22d/janusgraph-core/src/main/java/org/janusgraph/graphdb/tinkerpop/optimize/HasStepFolder.java#L213
Also more recently on [janusgraph-users](https://groups.google.com/d/msg/janusgraph-users/jUNvyQ0ohbw/Mbet-sdAAAAJ):
Query:
```
g.V().hasLabel("location").
has("location_type", 3).
order().by("location_id").
range(100000, 111000).toList()
```
Result: 8 minutes
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with HasStepFolder.java around the linked line and trace how IndexQuery handles range offsets. Reproduce the Gremlin query from the issue against a mixed index, then verify that range(100000, 111000) uses the index rather than relying on a long in-memory operation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100