| 
 | Terrier IR Platform 2.2.1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuk.ac.gla.terrier.structures.DocumentIndex
public class DocumentIndex
This class provides an interface for accessing the document index file. Each entry in the document index consists of a document id, the document number, and the length of the document, that is the number of terms that make up the document.
| Field Summary | |
|---|---|
|  int | entryLengthThe length in bytes of an entry in the file. | 
| Constructor Summary | |
|---|---|
| DocumentIndex()A default constructor for the class. | |
| DocumentIndex(java.lang.String filename)A constructor of a document index from a given filename. | |
| DocumentIndex(java.lang.String path,
              java.lang.String prefix) | |
| Method Summary | |
|---|---|
|  void | close()Closes the random access file. | 
|  FilePosition | getDirectIndexEndOffset()Returns the ending offset of the document's entry in the direct index. | 
|  FilePosition | getDirectIndexStartOffset()Returns the starting offset of the document's entry in the direct index. | 
|  int | getDocumentId(java.lang.String docno)Returns the document's id for the given docno. | 
|  int | getDocumentLength(int i)Reading the length for the i-th document. | 
|  int | getDocumentLength(java.lang.String docno)Return the length of the document with the given docno. | 
|  java.lang.String | getDocumentNumber(int i)Reading the docno for the i-th document. | 
|  int | getNumberOfDocuments()Returns the number of documents in the collection. | 
| static void | main(java.lang.String[] args) | 
|  void | print()Prints out to the standard error stream the contents of the document index file. | 
|  boolean | seek(int i)Seeks from the document index the i-th entry. | 
|  boolean | seek(java.lang.String docno)Seeks the document index entry for the given document number. | 
|  void | setDocnoEntryLength(int l)Set the length of docnos in the index file | 
|  void | setIndex(Index i)This structure can be configured by the Index object. | 
| Methods inherited from class java.lang.Object | 
|---|
| equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
public int entryLength
| Constructor Detail | 
|---|
public DocumentIndex()
public DocumentIndex(java.lang.String filename)
filename - String the filename of the document index, with an extension
public DocumentIndex(java.lang.String path,
                     java.lang.String prefix)
| Method Detail | 
|---|
public void setIndex(Index i)
setIndex in interface IndexConfigurablei - Index object to usepublic void setDocnoEntryLength(int l)
public void close()
close in interface Closeablepublic void print()
public int getDocumentId(java.lang.String docno)
docno - java.lang.String The document's number
public int getDocumentLength(int i)
i - the index of the document.
public int getDocumentLength(java.lang.String docno)
docno - java.lang.String The document's number
public java.lang.String getDocumentNumber(int i)
i - the index of the document.
public FilePosition getDirectIndexEndOffset()
public int getNumberOfDocuments()
public FilePosition getDirectIndexStartOffset()
public boolean seek(int i)
             throws java.io.IOException
i - the document id.
java.io.IOException
public boolean seek(java.lang.String docno)
             throws java.io.IOException
docno - java.lang.String the document's number
java.io.IOException - an input/output exception when it can 
                 not read from the filepublic static void main(java.lang.String[] args)
| 
 | Terrier IR Platform 2.2.1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||