Skip to content

Apache Lucene open-source search software

don't return invalid bytesref in lookupTerm

Robert Muir41cfa1701670
diff --git a/lucene/core/src/java/org/apache/lucene/index/SortedDocValues.java b/lucene/core/src/java/org/apache/lucene/index/SortedDocValues.java
index e2506087e9b..d49b274e04d 100644
--- a/lucene/core/src/java/org/apache/lucene/index/SortedDocValues.java
+++ b/lucene/core/src/java/org/apache/lucene/index/SortedDocValues.java
@@ -111,12 +111,16 @@ public abstract class SortedDocValues extends BinaryDocValues {
// pass this spare down to DiskDV, which will then
// "use" our byte[] ...
spare.bytes = BytesRef.EMPTY_BYTES;
+ spare.offset = 0;
+ spare.length = 0;
return mid; // key found
}
}
// nocommit is this the right way...
spare.bytes = BytesRef.EMPTY_BYTES;
+ spare.offset = 0;
+ spare.length = 0;
return -(low + 1); // key not found.
}
}