The DocIdSetIterator type exposes the following members.

Constructors

  NameDescription
Protected methodDocIdSetIterator
Initializes a new instance of the DocIdSetIterator class

Methods

  NameDescription
Public methodAdvance
Advances to the first beyond the current whose document number is greater than or equal to target. Returns the current document number or {@link #NO_MORE_DOCS} if there are no more docs in the set.

Behaves as if written:

            int advance(int target) {
            int doc;
            while ((doc = nextDoc()) < target) {
            }
            return doc;
            }
            
Some implementations are considerably more efficient than that.

NOTE: certain implemenations may return a different value (each time) if called several times in a row with the same target.

NOTE: this method may be called with {@value #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.

NOTE: after the iterator has exhausted you should not call this method, as it may result in unpredicted behavior.

NOTE: in 3.0 this method will become abstract, following the removal of {@link #SkipTo(int)}.

Public methodDoc Obsolete.
Unsupported anymore. Call {@link #DocID()} instead. This method throws {@link UnsupportedOperationException} if called.
Public methodDocID
Returns the following:
  • -1 or {@link #NO_MORE_DOCS} if {@link #NextDoc()} or {@link #Advance(int)} were not called yet.
  • {@link #NO_MORE_DOCS} if the iterator has exhausted.
  • Otherwise it should return the doc ID it is currently on.

NOTE: in 3.0, this method will become abstract.

Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodNext Obsolete.
Unsupported anymore. Call {@link #NextDoc()} instead. This method throws {@link UnsupportedOperationException} if called.
Public methodNextDoc
Advances to the next document in the set and returns the doc it is currently on, or {@link #NO_MORE_DOCS} if there are no more docs in the set.
NOTE: in 3.0 this method will become abstract, following the removal of {@link #Next()}. For backward compatibility it is implemented as:
            public int nextDoc() throws IOException {
            return next() ? doc() : NO_MORE_DOCS;
            }
            
NOTE: after the iterator has exhausted you should not call this method, as it may result in unpredicted behavior.
Public methodSkipTo Obsolete.
Unsupported anymore. Call {@link #Advance(int)} instead. This method throws {@link UnsupportedOperationException} if called.
Public methodToString
Returns a String that represents the current Object.
(Inherited from Object.)

Fields

  NameDescription
Public fieldStatic memberNO_MORE_DOCS
When returned by {@link #NextDoc()}, {@link #Advance(int)} and {@link #Doc()} it means there are no more docs in the iterator.

See Also