org.apache.lucene.util.packed
Class EliasFanoDocIdSet

java.lang.Object
  extended by org.apache.lucene.search.DocIdSet
      extended by org.apache.lucene.util.packed.EliasFanoDocIdSet

public class EliasFanoDocIdSet
extends DocIdSet

A DocIdSet in Elias-Fano encoding.

NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.

Constructor Summary
EliasFanoDocIdSet(int numValues, int upperBound)
          Construct an EliasFanoDocIdSet.
 
Method Summary
 void encodeFromDisi(DocIdSetIterator disi)
          Encode the document ids from a DocIdSetIterator.
 boolean equals(Object other)
           
 int hashCode()
           
 boolean isCacheable()
          This DocIdSet implementation is cacheable.
 DocIdSetIterator iterator()
          Provides a DocIdSetIterator to access encoded document ids.
static boolean sufficientlySmallerThanBitSet(long numValues, long upperBound)
          Provide an indication that is better to use an EliasFanoDocIdSet than a FixedBitSet to encode document identifiers.
 
Methods inherited from class org.apache.lucene.search.DocIdSet
bits
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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 Detail

sufficientlySmallerThanBitSet

public static boolean sufficientlySmallerThanBitSet(long numValues,
                                                    long upperBound)
Provide an indication that is better to use an EliasFanoDocIdSet than a FixedBitSet 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 least numValues.
Returns:
See EliasFanoEncoder.sufficientlySmallerThanBitSet(long, long)

encodeFromDisi

public void encodeFromDisi(DocIdSetIterator disi)
                    throws IOException
Encode the document ids from a DocIdSetIterator.

Parameters:
disi - This DocIdSetIterator should provide document ids that are consistent with numValues and upperBound as provided to the constructor.
Throws:
IOException

iterator

public DocIdSetIterator iterator()
Provides a DocIdSetIterator to access encoded document ids.

Specified by:
iterator in class DocIdSet

isCacheable

public boolean isCacheable()
This DocIdSet implementation is cacheable.

Overrides:
isCacheable in class DocIdSet
Returns:
true

equals

public boolean equals(Object other)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.