Terrier IR Platform
1.1.1

uk.ac.gla.terrier.structures
Class DocumentIndexOutputStream

java.lang.Object
  extended by uk.ac.gla.terrier.structures.DocumentIndexOutputStream

public class DocumentIndexOutputStream
extends java.lang.Object

A DocumentIndexOutputStream. Based on code from structures.indexing.DocumentIndexBuilder

Version:
$Revision: 1.5 $
Author:
Vassilis Plachouras, Craig Macdonald

Constructor Summary
DocumentIndexOutputStream()
          A default constructor for this document index output stream.
DocumentIndexOutputStream(java.lang.String filename)
          A constructor of a document index output stream from a given filename.
DocumentIndexOutputStream(java.lang.String path, java.lang.String prefix)
          A constructor of a document index output stream from an index path and prefix.
 
Method Summary
 void addEntry(java.lang.String docno, int docLength, FilePosition directIndexOffset)
          Adds to the index a new entry, giving to it the next available document id.
 void addEntry(java.lang.String docno, int docid, int docLength, long directIndexOffsetBytes, byte directIndexOffsetBits)
          As above, but for use when the docid is already known.
 void addEntry(java.lang.String docno, int docLength, long directIndexOffsetBytes, byte directIndexOffsetBits)
          Adds to the index a new entry, giving to it the next available document id.
 void close()
          Closes the random access file.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocumentIndexOutputStream

public DocumentIndexOutputStream()
A default constructor for this document index output stream. The default document index is created from ApplicationSetup.TERRIER_INDEX_PATH and ApplicationSetup.TERRIER_INDEX_PREFIX .


DocumentIndexOutputStream

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

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

DocumentIndexOutputStream

public DocumentIndexOutputStream(java.lang.String path,
                                 java.lang.String prefix)
A constructor of a document index output stream from an index path and prefix.

Parameters:
path - String path to the index
prefix - String prefix of the filenames of the index
Method Detail

addEntry

public void addEntry(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.

addEntry

public void addEntry(java.lang.String docno,
                     int docLength,
                     long directIndexOffsetBytes,
                     byte directIndexOffsetBits)
              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.
directIndexOffsetBytes - long the ending bytes position of the document's entry in the direct index.
directIndexOffsetBits - byte the ending bits position of the document's entry in the direct index.
Throws:
java.io.IOException - Throws an exception in the case of an IO error.

addEntry

public void addEntry(java.lang.String docno,
                     int docid,
                     int docLength,
                     long directIndexOffsetBytes,
                     byte directIndexOffsetBits)
              throws java.io.IOException
As above, but for use when the docid is already known. Do not MIX this and other addEntry() calls

Throws:
java.io.IOException

close

public void close()
Closes the random access file.


Terrier IR Platform
1.1.1

Terrier Information Retrieval Platform 1.1.1. Copyright 2004-2007 University of Glasgow