Skip to content

Apache Lucene open-source search software

fix test bug

Mike McCandless24ec3bd08566
diff --git a/lucene/test-framework/src/java/org/apache/lucene/index/BasePointsFormatTestCase.java b/lucene/test-framework/src/java/org/apache/lucene/index/BasePointsFormatTestCase.java
index b981aefea03..b55632b4f77 100644
--- a/lucene/test-framework/src/java/org/apache/lucene/index/BasePointsFormatTestCase.java
+++ b/lucene/test-framework/src/java/org/apache/lucene/index/BasePointsFormatTestCase.java
@@ -171,6 +171,11 @@ public abstract class BasePointsFormatTestCase extends BaseIndexFileFormatTestCa
PointValues values = ctx.reader().getPointValues();
NumericDocValues idValues = ctx.reader().getNumericDocValues("id");
+ if (idValues == null) {
+ // this is (surprisingly) OK, because if the random IWC flushes all 10 docs before the 11th doc is added, and force merge runs, it
+ // will drop the 100% deleted segments, and the "id" field never exists in the final single doc segment
+ continue;
+ }
int[] docIDToID = new int[ctx.reader().maxDoc()];
int docID;
while ((docID = idValues.nextDoc()) != NO_MORE_DOCS) {