diff --git a/warehouse/query-core/src/main/java/datawave/query/iterator/logic/OrIterator.java b/warehouse/query-core/src/main/java/datawave/query/iterator/logic/OrIterator.java index 371a2d1134..1ce7519bae 100644 --- a/warehouse/query-core/src/main/java/datawave/query/iterator/logic/OrIterator.java +++ b/warehouse/query-core/src/main/java/datawave/query/iterator/logic/OrIterator.java @@ -195,10 +195,12 @@ public T next() { } } } catch (WaitWindowOverrunException e) { - // if prev != null then it's a match that has not been returned Key possibleYieldKey = null; - if (prev != null || !candidateSet.isEmpty()) { - possibleYieldKey = (prev != null) ? (Key) prev : (Key) candidateSet.first(); + if (prev != null) { + // if prev != null then it's a match that has not been returned + possibleYieldKey = (Key) prev; + } else if (!isContextRequired() && !candidateSet.isEmpty()) { + possibleYieldKey = (Key) candidateSet.first(); } // When comparing possible yield keys in the OrIterator, we choose the lowest // key because a match in any sources can return a match