Terrier IR Platform
2.2.1

uk.ac.gla.terrier.structures.indexing
Class DirectIndexBuilder

java.lang.Object
  extended by uk.ac.gla.terrier.structures.indexing.DirectIndexBuilder
Direct Known Subclasses:
BlockDirectIndexBuilder

public class DirectIndexBuilder
extends java.lang.Object

Builds a direct index, using field information optionally.

Version:
$Revision: 1.18 $
Author:
Vassilis Plachouras & Craig Macdonald

Constructor Summary
DirectIndexBuilder()
          Constructs an instance of the direct index in the default index location for the direct file.
DirectIndexBuilder(Index i)
           
DirectIndexBuilder(java.lang.String filename)
          Constructs an instance of the direct index with a non-default name for the underlying direct file.
DirectIndexBuilder(java.lang.String path, java.lang.String prefix)
          Constructs an instance of the direct index using the given index path/prefix
 
Method Summary
 FilePosition addDocument(int[][] terms)
          Adds a document in the direct index, using field information optionally.
 void close()
          Closes the underlying gamma compressed file.
 void finishedCollections()
          When the indexing has reached the end of all collections, this method writes the buffers on disk and closes the corresponding files.
 void flushBuffer()
          Deprecated. since 2.0
 FilePosition getLastEndOffset()
          Returns the current offset in the direct index.
 void resetBuffer()
          Resets the internal buffer for writing data.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DirectIndexBuilder

public DirectIndexBuilder(Index i)

DirectIndexBuilder

public DirectIndexBuilder(java.lang.String path,
                          java.lang.String prefix)
Constructs an instance of the direct index using the given index path/prefix


DirectIndexBuilder

public DirectIndexBuilder()
Constructs an instance of the direct index in the default index location for the direct file.


DirectIndexBuilder

public DirectIndexBuilder(java.lang.String filename)
Constructs an instance of the direct index with a non-default name for the underlying direct file.

Parameters:
filename - the non-default filename used for the underlying direct file.
Method Detail

addDocument

public FilePosition addDocument(int[][] terms)
                         throws java.io.IOException
Adds a document in the direct index, using field information optionally. The addition of the document's terms in the data structure is handled by the protected methods addFieldDocument or addNoFieldDocument. This overloaded method uses the int[][] arrays, in the same format produced by the DirectIndex getTerms() method.

Parameters:
terms - int[][] the array that contains the document's terms to index.
Returns:
FilePosition the offset in the direct index after adding the terms.
Throws:
java.io.IOException

finishedCollections

public void finishedCollections()
When the indexing has reached the end of all collections, this method writes the buffers on disk and closes the corresponding files.


flushBuffer

public void flushBuffer()
Deprecated. since 2.0

Flushes the data to disk.


getLastEndOffset

public FilePosition getLastEndOffset()
Returns the current offset in the direct index.

Returns:
FilePosition the offset in the direct index.

resetBuffer

public void resetBuffer()
Resets the internal buffer for writing data. This method should be called before adding any documents to the direct index.


close

public void close()
           throws java.io.IOException
Closes the underlying gamma compressed file.

Throws:
java.io.IOException

Terrier IR Platform
2.2.1

Terrier Information Retrieval Platform 2.2.1. Copyright 2004-2008 University of Glasgow