You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ab...@apache.org on 2016/12/30 15:56:44 UTC
[08/50] [abbrv] lucene-solr:jira/solr-9854: LUCENE-7601: Make
DocIdMerger.next() unspecified when exhausted.
LUCENE-7601: Make DocIdMerger.next() unspecified when exhausted.
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/30a52277
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/30a52277
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/30a52277
Branch: refs/heads/jira/solr-9854
Commit: 30a52277dea16f4d15c40a0ec17f69076242496d
Parents: b733149
Author: Adrien Grand <jp...@gmail.com>
Authored: Thu Dec 22 19:49:12 2016 +0100
Committer: Adrien Grand <jp...@gmail.com>
Committed: Thu Dec 22 20:00:16 2016 +0100
----------------------------------------------------------------------
.../src/java/org/apache/lucene/index/DocIDMerger.java | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/30a52277/lucene/core/src/java/org/apache/lucene/index/DocIDMerger.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/java/org/apache/lucene/index/DocIDMerger.java b/lucene/core/src/java/org/apache/lucene/index/DocIDMerger.java
index dd0c9b7..1ef04c2 100644
--- a/lucene/core/src/java/org/apache/lucene/index/DocIDMerger.java
+++ b/lucene/core/src/java/org/apache/lucene/index/DocIDMerger.java
@@ -64,7 +64,9 @@ public abstract class DocIDMerger<T extends DocIDMerger.Sub> {
/** Reuse API, currently only used by postings during merge */
public abstract void reset() throws IOException;
- /** Returns null when done */
+ /** Returns null when done.
+ * <b>NOTE:</b> after the iterator has exhausted you should not call this
+ * method, as it may result in unpredicted behavior. */
public abstract T next() throws IOException;
private DocIDMerger() {}
@@ -93,10 +95,6 @@ public abstract class DocIDMerger<T extends DocIDMerger.Sub> {
@Override
public T next() throws IOException {
- if (current == null) {
- // NOTE: it's annoying that caller is allowed to call us again even after we returned null before
- return null;
- }
while (true) {
int docID = current.nextDoc();
if (docID == NO_MORE_DOCS) {
@@ -173,10 +171,6 @@ public abstract class DocIDMerger<T extends DocIDMerger.Sub> {
@Override
public T next() throws IOException {
T top = queue.top();
- if (top == null) {
- // NOTE: it's annoying that caller is allowed to call us again even after we returned null before
- return null;
- }
while (true) {
int docID = top.nextDoc();