deephacks / lmdbjni

LMDB for Java
Apache License 2.0
204 stars 28 forks source link

db.seek only finding exact matches #29

Closed raybellis closed 9 years ago

raybellis commented 9 years ago

Me again :)

I'm having trouble with db.seek only finding exact matches, and not (as per the documentation) "first key greater than or equal to specified key".

I believe the culprit is this, from EntryIterator.java:

 public boolean hasNext() {
    if (first) {
      if (key != null) {
        this.entry = cursor.seek(SeekOp.KEY, key);
      }

shouldn't that be SeekOp.RANGE rather than .KEY ?

raybellis commented 9 years ago

FWIW, I've just made this change locally and tested it and am now getting perfect results with my custom comparator :) Thanks loads for the help!

krisskross commented 9 years ago

Great! If you send me a pull request i'll merge it in.