From 08697b2ba8ca78c7f6f3ac9bdf154bb94defbbcd Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Wed, 24 Jul 2013 18:04:13 +0200 Subject: [PATCH] Fix test-bug that produced ordinals with gaps --- .../unit/index/fielddata/ordinals/MultiOrdinalsTests.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/test/java/org/elasticsearch/test/unit/index/fielddata/ordinals/MultiOrdinalsTests.java b/src/test/java/org/elasticsearch/test/unit/index/fielddata/ordinals/MultiOrdinalsTests.java index 217194dfca5..2bbd17d20c5 100644 --- a/src/test/java/org/elasticsearch/test/unit/index/fielddata/ordinals/MultiOrdinalsTests.java +++ b/src/test/java/org/elasticsearch/test/unit/index/fielddata/ordinals/MultiOrdinalsTests.java @@ -83,6 +83,7 @@ public class MultiOrdinalsTests extends ElasticsearchTestCase { lastOrd = ordAndId.ord; builder.nextOrdinal(); } + ordAndId.ord = builder.currentOrdinal(); // remap the ordinals in case we have gaps? builder.addDoc(ordAndId.id); } @@ -117,9 +118,9 @@ public class MultiOrdinalsTests extends ElasticsearchTestCase { assertThat(docs.getOrd(docId), equalTo(docOrds.get(0))); LongsRef ref = docs.getOrds(docId); assertThat(ref.offset, equalTo(0)); - + for (int i = ref.offset; i < ref.length; i++) { - assertThat(ref.longs[i], equalTo(docOrds.get(i))); + assertThat("index: " + i + " offset: " + ref.offset + " len: " + ref.length, ref.longs[i], equalTo(docOrds.get(i))); } final long[] array = new long[docOrds.size()]; for (int i = 0; i < array.length; i++) { @@ -140,7 +141,7 @@ public class MultiOrdinalsTests extends ElasticsearchTestCase { } public static class OrdAndId { - final long ord; + long ord; final int id; public OrdAndId(long ord, int id) {