Package org.apache.lucene.util
Class DocIdSetBuilder
java.lang.Object
org.apache.lucene.util.DocIdSetBuilder
A builder of
DocIdSet
s. At first it uses a sparse structure to gather documents, and then
upgrades to a non-sparse bit set once enough hits match.
To add documents, you first need to call grow(int)
in order to reserve space, and then
call DocIdSetBuilder.BulkAdder.add(int)
on the returned DocIdSetBuilder.BulkAdder
.
- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Utility class to efficiently add many docs in one go. -
Constructor Summary
ConstructorsConstructorDescriptionDocIdSetBuilder
(int maxDoc) Create a builder that can contain doc IDs between0
andmaxDoc
.DocIdSetBuilder
(int maxDoc, PointValues values, String field) Create aDocIdSetBuilder
instance that is optimized for accumulating docs that match the givenPointValues
.DocIdSetBuilder
(int maxDoc, Terms terms) Create aDocIdSetBuilder
instance that is optimized for accumulating docs that match the givenTerms
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(DocIdSetIterator iter) Add the content of the providedDocIdSetIterator
to this builder.build()
Build aDocIdSet
from the accumulated doc IDs.grow
(int numDocs) Reserve space and return aDocIdSetBuilder.BulkAdder
object that can be used to add up tonumDocs
documents.
-
Constructor Details
-
DocIdSetBuilder
public DocIdSetBuilder(int maxDoc) Create a builder that can contain doc IDs between0
andmaxDoc
. -
DocIdSetBuilder
Create aDocIdSetBuilder
instance that is optimized for accumulating docs that match the givenTerms
.- Throws:
IOException
-
DocIdSetBuilder
Create aDocIdSetBuilder
instance that is optimized for accumulating docs that match the givenPointValues
.- Throws:
IOException
-
-
Method Details
-
add
Add the content of the providedDocIdSetIterator
to this builder. NOTE: if you need to build aDocIdSet
out of a singleDocIdSetIterator
, you should rather useRoaringDocIdSet.Builder
.- Throws:
IOException
-
grow
Reserve space and return aDocIdSetBuilder.BulkAdder
object that can be used to add up tonumDocs
documents. -
build
Build aDocIdSet
from the accumulated doc IDs.
-