Package org.apache.lucene.util
Class SortedVIntList
- java.lang.Object
-
- org.apache.lucene.search.DocIdSet
-
- org.apache.lucene.util.SortedVIntList
-
public class SortedVIntList extends DocIdSet
Stores and iterate on sorted integers in compressed form in RAM.
The code for compressing the differences between ascending integers was borrowed fromIndexInputandIndexOutput.NOTE: this class assumes the stored integers are doc Ids (hence why it extends
DocIdSet). Therefore itsiterator()assumesDocIdSetIterator.NO_MORE_DOCScan be used as sentinel. If you intent to use this value, then make sure it's not used during search flow.- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
-
-
Field Summary
-
Fields inherited from class org.apache.lucene.search.DocIdSet
EMPTY_DOCIDSET
-
-
Constructor Summary
Constructors Constructor Description SortedVIntList(int... sortedInts)Create a SortedVIntList from all elements of an array of integers.SortedVIntList(int[] sortedInts, int inputSize)Create a SortedVIntList from an array of integers.SortedVIntList(BitSet bits)Create a SortedVIntList from a BitSet.SortedVIntList(DocIdSetIterator docIdSetIterator)Create a SortedVIntList.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetByteSize()booleanisCacheable()This DocIdSet implementation is cacheable.DocIdSetIteratoriterator()Provides aDocIdSetIteratorto access the set.intsize()
-
-
-
Constructor Detail
-
SortedVIntList
public SortedVIntList(int... sortedInts)
Create a SortedVIntList from all elements of an array of integers.- Parameters:
sortedInts- A sorted array of non negative integers.
-
SortedVIntList
public SortedVIntList(int[] sortedInts, int inputSize)Create a SortedVIntList from an array of integers.- Parameters:
sortedInts- An array of sorted non negative integers.inputSize- The number of integers to be used from the array.
-
SortedVIntList
public SortedVIntList(BitSet bits)
Create a SortedVIntList from a BitSet.- Parameters:
bits- A bit set representing a set of integers.
-
SortedVIntList
public SortedVIntList(DocIdSetIterator docIdSetIterator) throws IOException
Create a SortedVIntList.- Parameters:
docIdSetIterator- An iterator providing document numbers as a set of integers. This DocIdSetIterator is iterated completely when this constructor is called and it must provide the integers in non decreasing order.- Throws:
IOException
-
-
Method Detail
-
size
public int size()
- Returns:
- The total number of sorted integers.
-
getByteSize
public int getByteSize()
- Returns:
- The size of the byte array storing the compressed sorted integers.
-
isCacheable
public boolean isCacheable()
This DocIdSet implementation is cacheable.- Overrides:
isCacheablein classDocIdSet
-
iterator
public DocIdSetIterator iterator()
Description copied from class:DocIdSetProvides aDocIdSetIteratorto access the set. This implementation can returnnullorDocIdSet.EMPTY_DOCIDSET.iterator()if there are no docs that match.
-
-