BKDWriter: also fix split to read ord after docID

This commit is contained in:
Mike McCandless 2016-03-24 11:22:03 -04:00
parent f859bab35f
commit 5b3e07a98a
2 changed files with 15 additions and 15 deletions

View File

@ -171,11 +171,13 @@ final class OfflinePointReader extends PointReader {
byte[] buffer = new byte[bytesPerDoc];
while (count > 0) {
in.readBytes(buffer, 0, buffer.length);
long ord;
if (longOrds) {
ord = readLong(buffer, packedBytesLength);
if (singleValuePerDoc == false) {
ord = readInt(buffer, packedBytesLength+Integer.BYTES);
} else if (longOrds) {
ord = readLong(buffer, packedBytesLength+Integer.BYTES);
} else {
// This is either ord (multi-valued case) or docID (which we use as ord in the single valued case):
ord = readInt(buffer, packedBytesLength);
}

View File

@ -864,22 +864,20 @@ public class TestBKD extends LuceneTestCase {
}
};
Throwable t;
if (TEST_ASSERTS_ENABLED) {
t = expectThrows(AssertionError.class, () -> {
verify(dir, docValues, null, numDims, numBytesPerDim, 50, 0.1);
});
} else {
t = expectThrows(ArrayIndexOutOfBoundsException.class, () -> {
verify(dir, docValues, null, numDims, numBytesPerDim, 50, 0.1);
});
}
Throwable t = expectThrows(CorruptIndexException.class, () -> {
verify(dir, docValues, null, numDims, numBytesPerDim, 50, 0.1);
});
assertCorruptionDetected(t);
}
}
private void assertCorruptionDetected(Throwable t) {
if (t instanceof CorruptIndexException) {
if (t.getMessage().contains("checksum failed (hardware problem?)")) {
return;
}
}
for(Throwable suppressed : t.getSuppressed()) {
if (suppressed instanceof CorruptIndexException) {
if (suppressed.getMessage().contains("checksum failed (hardware problem?)")) {
@ -887,7 +885,7 @@ public class TestBKD extends LuceneTestCase {
}
}
}
fail("did not see a supporessed CorruptIndexException");
fail("did not see a suppressed CorruptIndexException");
}
public void testTieBreakOrder() throws Exception {