Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

LUCENE-4313: make it clear that DISI.advance behavior is undefined if target <= current

Michael McCandless8b0b98e27d74
diff --git a/lucene/core/src/java/org/apache/lucene/search/DocIdSetIterator.java b/lucene/core/src/java/org/apache/lucene/search/DocIdSetIterator.java
index 3a77fc746e7..900fc1e8811 100644
--- a/lucene/core/src/java/org/apache/lucene/search/DocIdSetIterator.java
+++ b/lucene/core/src/java/org/apache/lucene/search/DocIdSetIterator.java
@@ -60,13 +60,17 @@ public abstract class DocIdSetIterator {
*/
public abstract int nextDoc() throws IOException;
- /**
- * Advances to the first beyond (see NOTE below) the current whose document
- * number is greater than or equal to <i>target</i>. Returns the current
- * document number or {@link #NO_MORE_DOCS} if there are no more docs in the
- * set.
+ /**
+ * Advances to the first beyond the current whose document number is greater
+ * than or equal to <i>target</i>, and returns the document number itself.
+ * Exhausts the iterator and returns {@link #NO_MORE_DOCS} if <i>target</i>
+ * is greater than the highest document number in the set.
+ * <p>
+ * The behavior of this method is <b>undefined</b> when called with
+ * <code> target &le; current</code>, or after the iterator has exhausted.
+ * Both cases may result in unpredicted behavior.
* <p>
- * Behaves as if written:
+ * When <code> target &gt; current</code> it behaves as if written:
*
* <pre>
* int advance(int target) {
@@ -79,18 +83,12 @@ public abstract class DocIdSetIterator {
*
* Some implementations are considerably more efficient than that.
* <p>
- * <b>NOTE:</b> when <code> target &le; current</code> implementations may opt
- * not to advance beyond their current {@link #docID()}.
- * <p>
* <b>NOTE:</b> this method may be called with {@link #NO_MORE_DOCS} for
* efficiency by some Scorers. If your implementation cannot efficiently
* determine that it should exhaust, it is recommended that you check for that
* value in each call to this method.
* <p>
- * <b>NOTE:</b> after the iterator has exhausted you should not call this
- * method, as it may result in unpredicted behavior.
- * <p>
- *
+ *
* @since 2.9
*/
public abstract int advance(int target) throws IOException;