Package org.apache.lucene.util.packed
Class EliasFanoDocIdSet
java.lang.Object
org.apache.lucene.search.DocIdSet
org.apache.lucene.util.packed.EliasFanoDocIdSet
A DocIdSet in Elias-Fano encoding.
-
Constructor Summary
ConstructorsConstructorDescriptionEliasFanoDocIdSet
(int numValues, int upperBound) Construct an EliasFanoDocIdSet. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Encode the document ids from a DocIdSetIterator.boolean
int
hashCode()
boolean
This DocIdSet implementation is cacheable.iterator()
Provides aDocIdSetIterator
to access encoded document ids.static boolean
sufficientlySmallerThanBitSet
(long numValues, long upperBound) Provide an indication that is better to use anEliasFanoDocIdSet
than aFixedBitSet
to encode document identifiers.
-
Constructor Details
-
EliasFanoDocIdSet
public EliasFanoDocIdSet(int numValues, int upperBound) Construct an EliasFanoDocIdSet. For efficient encoding, the parameters should be chosen as low as possible.- Parameters:
numValues
- At least the number of document ids that will be encoded.upperBound
- At least the highest document id that will be encoded.
-
-
Method Details
-
sufficientlySmallerThanBitSet
public static boolean sufficientlySmallerThanBitSet(long numValues, long upperBound) Provide an indication that is better to use anEliasFanoDocIdSet
than aFixedBitSet
to encode document identifiers.- Parameters:
numValues
- The number of document identifiers that is to be encoded. Should be non negative.upperBound
- The maximum possible value for a document identifier. Should be at leastnumValues
.- Returns:
- See
EliasFanoEncoder.sufficientlySmallerThanBitSet(long, long)
-
encodeFromDisi
Encode the document ids from a DocIdSetIterator.- Parameters:
disi
- This DocIdSetIterator should provide document ids that are consistent withnumValues
andupperBound
as provided to the constructor.- Throws:
IOException
-
iterator
Provides aDocIdSetIterator
to access encoded document ids. -
isCacheable
public boolean isCacheable()This DocIdSet implementation is cacheable.- Overrides:
isCacheable
in classDocIdSet
- Returns:
true
-
equals
-
hashCode
public int hashCode()
-