Skip to content

Apache Lucene open-source search software

fix docID() when multi-phrase enum hits NO_MORE_DOCS

Robert Muire12dbe663a9f
diff --git a/lucene/core/src/java/org/apache/lucene/search/MultiPhraseQuery.java b/lucene/core/src/java/org/apache/lucene/search/MultiPhraseQuery.java
index ffaa7012390..3d1fa5eb799 100644
--- a/lucene/core/src/java/org/apache/lucene/search/MultiPhraseQuery.java
+++ b/lucene/core/src/java/org/apache/lucene/search/MultiPhraseQuery.java
@@ -499,7 +499,7 @@ class UnionDocsAndPositionsEnum extends DocsAndPositionsEnum {
@Override
public final int nextDoc() throws IOException {
if (_queue.size() == 0) {
- return NO_MORE_DOCS;
+ return _doc = NO_MORE_DOCS;
}
// TODO: move this init into positions(): if the search