Package org.apache.lucene.util
Class DocIdSetBuilder
- java.lang.Object
-
- org.apache.lucene.util.DocIdSetBuilder
-
public final class DocIdSetBuilder extends Object
A builder ofDocIdSets. 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 callDocIdSetBuilder.BulkAdder.add(int)on the returnedDocIdSetBuilder.BulkAdder.- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDocIdSetBuilder.BulkAdderUtility class to efficiently add many docs in one go.
-
Constructor Summary
Constructors Constructor Description DocIdSetBuilder(int maxDoc)Create a builder that can contain doc IDs between0andmaxDoc.DocIdSetBuilder(int maxDoc, PointValues values, String field)Create aDocIdSetBuilderinstance that is optimized for accumulating docs that match the givenPointValues.DocIdSetBuilder(int maxDoc, Terms terms)Create aDocIdSetBuilderinstance that is optimized for accumulating docs that match the givenTerms.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(DocIdSetIterator iter)Add the content of the providedDocIdSetIteratorto this builder.DocIdSetbuild()Build aDocIdSetfrom the accumulated doc IDs.DocIdSetBuilder.BulkAddergrow(int numDocs)Reserve space and return aDocIdSetBuilder.BulkAdderobject that can be used to add up tonumDocsdocuments.
-
-
-
Constructor Detail
-
DocIdSetBuilder
public DocIdSetBuilder(int maxDoc)
Create a builder that can contain doc IDs between0andmaxDoc.
-
DocIdSetBuilder
public DocIdSetBuilder(int maxDoc, Terms terms) throws IOExceptionCreate aDocIdSetBuilderinstance that is optimized for accumulating docs that match the givenTerms.- Throws:
IOException
-
DocIdSetBuilder
public DocIdSetBuilder(int maxDoc, PointValues values, String field) throws IOExceptionCreate aDocIdSetBuilderinstance that is optimized for accumulating docs that match the givenPointValues.- Throws:
IOException
-
-
Method Detail
-
add
public void add(DocIdSetIterator iter) throws IOException
Add the content of the providedDocIdSetIteratorto this builder. NOTE: if you need to build aDocIdSetout of a singleDocIdSetIterator, you should rather useRoaringDocIdSet.Builder.- Throws:
IOException
-
grow
public DocIdSetBuilder.BulkAdder grow(int numDocs)
Reserve space and return aDocIdSetBuilder.BulkAdderobject that can be used to add up tonumDocsdocuments.
-
-