Package org.apache.lucene.search
Class DocIdStream
java.lang.Object
org.apache.lucene.search.DocIdStream
A stream of doc IDs. Doc IDs may be consumed at most once.
- See Also:
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSole constructor, for invocation by sub classes. -
Method Summary
Modifier and TypeMethodDescriptionintcount()Count the number of entries in this stream.abstract intcount(int upTo) Count the number of doc IDs in this stream that are below the givenupTo.abstract voidforEach(int upTo, CheckedIntConsumer<IOException> consumer) Iterate over doc IDs contained in this doc ID stream up to the givenupToexclusive, calling the givenCheckedIntConsumeron them.voidforEach(CheckedIntConsumer<IOException> consumer) Iterate over doc IDs contained in this stream in order, calling the givenCheckedIntConsumeron them.intintoArray(int[] array) Copy some matching doc IDs into the provided array and return the number of copied elements.abstract intintoArray(int upTo, int[] array) Copy some matching doc IDs underupTo(exclusive) into the provided array and return the number of copied elements.abstract booleanReturntrueif this stream may have remaining doc IDs.
-
Constructor Details
-
DocIdStream
protected DocIdStream()Sole constructor, for invocation by sub classes.
-
-
Method Details
-
forEach
Iterate over doc IDs contained in this stream in order, calling the givenCheckedIntConsumeron them. This is a terminal operation.- Throws:
IOException
-
forEach
Iterate over doc IDs contained in this doc ID stream up to the givenupToexclusive, calling the givenCheckedIntConsumeron them. It is not possible to iterate these doc IDs again later on.- Throws:
IOException
-
count
Count the number of entries in this stream. This is a terminal operation.- Throws:
IOException
-
count
Count the number of doc IDs in this stream that are below the givenupTo. These doc IDs may not be consumed again later.- Throws:
IOException
-
intoArray
public int intoArray(int[] array) Copy some matching doc IDs into the provided array and return the number of copied elements. A return value of0indicates that there are no remaining doc IDs. The given array must not be empty. -
intoArray
public abstract int intoArray(int upTo, int[] array) Copy some matching doc IDs underupTo(exclusive) into the provided array and return the number of copied elements. A return value of0indicates that there are no matching doc IDs underupToanymore. The given array must not be empty. -
mayHaveRemaining
public abstract boolean mayHaveRemaining()Returntrueif this stream may have remaining doc IDs. This must eventually returnfalsewhen the stream is exhausted.
-