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

java.lang.Object
  extended by it.unimi.di.mg4j.index.Index
      extended by it.unimi.di.mg4j.index.remote.RemoteIndex
All Implemented Interfaces:
Serializable

public class RemoteIndex
extends Index

A remote index.

Remote indices (as opposed to remote bitstream indices) provide access to document iterators only. For composite indices this is the only possible access, as there is not underlying bit stream to export.

When a new IndexReader is created, this index connects to the server and will start a new server thread that will interact with the returned RemoteIndexReader.

Since:
1.1
Author:
Sebastiano Vigna
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class it.unimi.di.mg4j.index.Index
Index.EmptyIndexIterator, Index.PropertyKeys, Index.UriKeys
 
Field Summary
static int DEFAULT_BUFFER_SIZE
          The default buffer size.
 SocketAddress socketAddress
          The socket exporting the index.
 
Fields inherited from class it.unimi.di.mg4j.index.Index
field, hasCounts, hasPayloads, hasPositions, keyIndex, maxCount, numberOfDocuments, numberOfOccurrences, numberOfPostings, numberOfTerms, payload, prefixMap, properties, singletonSet, sizes, termMap, termProcessor
 
Constructor Summary
RemoteIndex(SocketAddress socketAddress, int numberOfDocuments, int numberOfTerms, long numberOfPostings, long numberOfOccurrences, int maxCount, Payload payload, boolean hasCounts, boolean hasPositions, TermProcessor termProcessor, String field, IntList sizes, Properties properties)
           
 
Method Summary
 IndexIterator documents(CharSequence prefix, int limit)
          Creates a number of instances of IndexReader for this index and uses them to return a MultiTermIndexIterator over the documents containing any term our of a set of terms defined by a prefix; the prefix is given explicitly, and unless the index has a prefix map, an UnsupportedOperationException will be thrown.
 IndexReader getReader(int bufferSize)
          Creates and returns a new IndexReader based on this index.
 
Methods inherited from class it.unimi.di.mg4j.index.Index
documents, documents, getEmptyIndexIterator, getEmptyIndexIterator, getEmptyIndexIterator, getEmptyIndexIterator, getInstance, getInstance, getInstance, getInstance, getInstance, getReader, getTermProcessor, keyIndex
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_BUFFER_SIZE

public static final int DEFAULT_BUFFER_SIZE
The default buffer size.

See Also:
Constant Field Values

socketAddress

public final SocketAddress socketAddress
The socket exporting the index.

Constructor Detail

RemoteIndex

public RemoteIndex(SocketAddress socketAddress,
                   int numberOfDocuments,
                   int numberOfTerms,
                   long numberOfPostings,
                   long numberOfOccurrences,
                   int maxCount,
                   Payload payload,
                   boolean hasCounts,
                   boolean hasPositions,
                   TermProcessor termProcessor,
                   String field,
                   IntList sizes,
                   Properties properties)
Method Detail

getReader

public IndexReader getReader(int bufferSize)
                      throws IOException
Description copied from class: Index
Creates and returns a new IndexReader based on this index. After that, you can use the reader to read this index.

Specified by:
getReader in class Index
Parameters:
bufferSize - the size of the buffer to be used accessing the reader, or -1 for a default buffer size.
Returns:
a new IndexReader to read this index.
Throws:
IOException

documents

public IndexIterator documents(CharSequence prefix,
                               int limit)
Description copied from class: Index
Creates a number of instances of IndexReader for this index and uses them to return a MultiTermIndexIterator over the documents containing any term our of a set of terms defined by a prefix; the prefix is given explicitly, and unless the index has a prefix map, an UnsupportedOperationException will be thrown.

Overrides:
documents in class Index
Parameters:
prefix - a prefix.
limit - a limit on the number of terms that will be used to resolve the prefix query; if the terms starting with prefix are more than limit, a TooManyTermsException will be thrown.