it.unimi.di.mg4j.index
Class BitStreamIndexReader

java.lang.Object
  extended by it.unimi.di.mg4j.index.AbstractIndexReader
      extended by it.unimi.di.mg4j.index.BitStreamIndexReader
All Implemented Interfaces:
IndexReader, SafelyCloseable, Closeable

public class BitStreamIndexReader
extends AbstractIndexReader

A bitstream-based index reader.


Nested Class Summary
protected static class BitStreamIndexReader.BitStreamIndexReaderIndexIterator
           
 
Field Summary
protected  BitStreamIndex index
          The reference index.
protected  BitStreamIndexReader.BitStreamIndexReaderIndexIterator indexIterator
          The BitStreamIndexReader.BitStreamIndexReaderIndexIterator view of this reader (returned by documents(CharSequence)).
 
Fields inherited from class it.unimi.di.mg4j.index.AbstractIndexReader
closed
 
Constructor Summary
BitStreamIndexReader(BitStreamIndex index, InputBitStream ibs)
          Creates a new skip index reader, with the specified underlying Index and input bit stream.
 
Method Summary
 void close()
           
 IndexIterator documents(CharSequence term)
          Returns an index iterator over the documents containing a term; the term is given explicitly.
 IndexIterator documents(int term)
          Returns a document iterator over the documents containing a term.
 IndexIterator nextIterator()
          Throws an UnsupportedOperationException.
 String toString()
           
 
Methods inherited from class it.unimi.di.mg4j.index.AbstractIndexReader
finalize
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

index

protected final BitStreamIndex index
The reference index.


indexIterator

protected final BitStreamIndexReader.BitStreamIndexReaderIndexIterator indexIterator
The BitStreamIndexReader.BitStreamIndexReaderIndexIterator view of this reader (returned by documents(CharSequence)).

Constructor Detail

BitStreamIndexReader

public BitStreamIndexReader(BitStreamIndex index,
                            InputBitStream ibs)
Creates a new skip index reader, with the specified underlying Index and input bit stream.

Parameters:
index - the index.
ibs - the underlying bit stream.
Method Detail

documents

public IndexIterator documents(int term)
                        throws IOException
Description copied from interface: IndexReader
Returns a document iterator over the documents containing a term.

Note that the index iterator returned by this method will return null on a call to term().

Note that it is always possible to call this method with argument 0, even if the underlying index does not provide random access.

Parameters:
term - the number of a term.
Throws:
IOException

documents

public IndexIterator documents(CharSequence term)
                        throws IOException
Description copied from interface: IndexReader
Returns an index iterator over the documents containing a term; the term is given explicitly.

Unless the term processor of the associated index is null, words coming from a query will have to be processed before being used with this method.

Note that the index iterator returned by this method will return term on a call to term().

Parameters:
term - a term (the term will be downcased if the index is case insensitive).
Throws:
IOException

nextIterator

public IndexIterator nextIterator()
                           throws IOException
Description copied from class: AbstractIndexReader
Throws an UnsupportedOperationException.

Specified by:
nextIterator in interface IndexReader
Overrides:
nextIterator in class AbstractIndexReader
Returns:
the index iterator of the next term, or null if there are no more terms after the current one.
Throws:
IOException

toString

public String toString()
Overrides:
toString in class Object

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Overrides:
close in class AbstractIndexReader
Throws:
IOException