it.unimi.di.mg4j.index.remote
Class RemoteIndexReader

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

public class RemoteIndexReader
extends AbstractIndexReader

An index reader for RemoteIndex.

Author:
Sebastiano Vigna, Alessandro Arrabito

Nested Class Summary
static class RemoteIndexReader.ServerThread
           
 
Field Summary
protected  RemoteIndexServerConnection connection
          The remote server connection used to call the index server.
protected  Index index
          The index we refer to.
protected  DataInputStream inputStream
          The input stream in connection, cached.
protected  DataOutputStream outputStream
          The output stream in connection, cached.
protected  it.unimi.di.mg4j.index.remote.RemoteIndexReader.RemoteIndexReaderIndexIterator remoteIndexIterator
          The index iterator associated with this reader.
 
Fields inherited from class it.unimi.di.mg4j.index.AbstractIndexReader
closed
 
Constructor Summary
RemoteIndexReader(RemoteIndex index, int bufferSize)
           
 
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 termNumber)
          Returns a document iterator over the documents containing a term.
protected  void finalize()
           
 
Methods inherited from class it.unimi.di.mg4j.index.AbstractIndexReader
nextIterator
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

index

protected final Index index
The index we refer to.


connection

protected final RemoteIndexServerConnection connection
The remote server connection used to call the index server.


remoteIndexIterator

protected final it.unimi.di.mg4j.index.remote.RemoteIndexReader.RemoteIndexReaderIndexIterator remoteIndexIterator
The index iterator associated with this reader.


inputStream

protected final DataInputStream inputStream
The input stream in connection, cached.


outputStream

protected final DataOutputStream outputStream
The output stream in connection, cached.

Constructor Detail

RemoteIndexReader

public RemoteIndexReader(RemoteIndex index,
                         int bufferSize)
                  throws IOException
Throws:
IOException
Method Detail

close

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

finalize

protected void finalize()
                 throws Throwable
Overrides:
finalize in class AbstractIndexReader
Throws:
Throwable

documents

public IndexIterator documents(int termNumber)
                        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:
termNumber - 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