From 5b3e07a98ac2513de3968bcdc5d0c943a940ce84 Mon Sep 17 00:00:00 2001 From: Mike McCandless Date: Thu, 24 Mar 2016 11:22:03 -0400 Subject: [PATCH] BKDWriter: also fix split to read ord after docID --- .../lucene/util/bkd/OfflinePointReader.java | 8 ++++--- .../org/apache/lucene/util/bkd/TestBKD.java | 22 +++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lucene/core/src/java/org/apache/lucene/util/bkd/OfflinePointReader.java b/lucene/core/src/java/org/apache/lucene/util/bkd/OfflinePointReader.java index f3bf2bc08cb..830e37b9cd7 100644 --- a/lucene/core/src/java/org/apache/lucene/util/bkd/OfflinePointReader.java +++ b/lucene/core/src/java/org/apache/lucene/util/bkd/OfflinePointReader.java @@ -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); } diff --git a/lucene/core/src/test/org/apache/lucene/util/bkd/TestBKD.java b/lucene/core/src/test/org/apache/lucene/util/bkd/TestBKD.java index 1aaa689de24..18fbacf3890 100644 --- a/lucene/core/src/test/org/apache/lucene/util/bkd/TestBKD.java +++ b/lucene/core/src/test/org/apache/lucene/util/bkd/TestBKD.java @@ -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 {