Terrier IR Platform
2.2.1

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

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

public class DocumentIndexBuilder
extends java.lang.Object

A builder for the document index.

Version:
$Revision: 1.22 $
Author:
Vassilis Plachouras

Constructor Summary
DocumentIndexBuilder()
          Deprecated.  
DocumentIndexBuilder(Index i)
          Construct a DocumentIndex associated with the specified index
DocumentIndexBuilder(java.lang.String filename)
          A constructor of a document index from a given filename.
DocumentIndexBuilder(java.lang.String path, java.lang.String prefix)
          Constructor using index path and prefix.
 
Method Summary
 void addEntryToBuffer(java.lang.String docno, int docLength)
          Adds to the index a new entry, giving to it the next available document id.
 void addEntryToBuffer(java.lang.String docno, int docLength, FilePosition directIndexOffset)
          Adds to the index a new entry, giving to it the next available document id.
 void close()
          Closes the random access file.
 void finishedCollections()
          Closes the underlying file after finished processing the collections.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocumentIndexBuilder

public DocumentIndexBuilder()
Deprecated. 

A default constructor for the class. Uses the default index path and prefix


DocumentIndexBuilder

public DocumentIndexBuilder(Index i)
Construct a DocumentIndex associated with the specified index

Parameters:
i - Index being constructed

DocumentIndexBuilder

public DocumentIndexBuilder(java.lang.String path,
                            java.lang.String prefix)
Constructor using index path and prefix.

Parameters:
path - path to the index
prefix - filename prefix of the index

DocumentIndexBuilder

public DocumentIndexBuilder(java.lang.String filename)
A constructor of a document index from a given filename.

Parameters:
filename - String the filename of the document index, with an extension
Method Detail

addEntryToBuffer

public void addEntryToBuffer(java.lang.String docno,
                             int docLength,
                             FilePosition directIndexOffset)
                      throws java.io.IOException
Adds to the index a new entry, giving to it the next available document id. The entry is writen first to the buffer, which afterwards has to be flushed to the file on disk.

Parameters:
docno - String the document number.
docLength - int the number of indexed tokens in the document.
directIndexOffset - FilePosition the ending position of the document's entry in the direct index.
Throws:
java.io.IOException - Throws an exception in the case of an IO error.
ArrayOutOfBoundsException - The docno being written is too long

addEntryToBuffer

public void addEntryToBuffer(java.lang.String docno,
                             int docLength)
                      throws java.io.IOException
Adds to the index a new entry, giving to it the next available document id. The entry is writen first to the buffer, which afterwards has to be flushed to the file on disk.

Parameters:
docno - String the document number.
docLength - int the number of indexed tokens in the document.
Throws:
java.io.IOException - Throws an exception in the case of an IO error.

close

public void close()
Closes the random access file.


finishedCollections

public void finishedCollections()
Closes the underlying file after finished processing the collections.


Terrier IR Platform
2.2.1

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