|
Terrier IR Platform 2.2.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object uk.ac.gla.terrier.structures.DocumentIndex uk.ac.gla.terrier.structures.DocumentIndexEncoded
public class DocumentIndexEncoded
A document index class which reads the .docid file and keeps its contents in a array of bytes in memory. This class reduces the memory overhead introduced when we use the class DocumentIndexInMemory, by decoding the information on the fly.
Field Summary |
---|
Fields inherited from class uk.ac.gla.terrier.structures.DocumentIndex |
---|
entryLength |
Constructor Summary | |
---|---|
DocumentIndexEncoded()
|
|
DocumentIndexEncoded(java.lang.String filename)
A constructor for DocumentIndexInMemory that specifies the file to open. |
|
DocumentIndexEncoded(java.lang.String path,
java.lang.String prefix)
The default constructor for DocumentIndexInMemory. |
Method Summary | |
---|---|
FilePosition |
getDirectIndexEndOffset()
Returns the ending offset of the current document's entry in the direct index. |
FilePosition |
getDirectIndexStartOffset()
Returns the starting offset of the current document's entry in the direct index. |
int |
getDocumentId(java.lang.String docno)
Returns the id of a document with a given document number. |
int |
getDocumentLength(int docid)
Returns the length of a document with a given id. |
int |
getDocumentLength(java.lang.String docno)
Returns the document length of the document with a given document number . |
java.lang.String |
getDocumentNumber(int docid)
Returns the number of a document with a given id. |
int |
getNumberOfDocuments()
Returns the number of documents in the document index. |
void |
loadIntoMemory(java.io.DataInputStream dis,
int numOfEntries)
Loads the data from the file into memory. |
static void |
main(java.lang.String[] args)
A main method for testing the DocumentIndexEncoded class. |
void |
print()
Prints to the standard error the document index structure, which is loaded into memory. |
boolean |
seek(int i)
Overrides the seek(int docid) method of the DocumentIndex class. |
boolean |
seek(java.lang.String docno)
Overrides the seek(String s) method of the super class. |
void |
setDocnoEntryLength(int l)
Set the length of docnos in the index file |
Methods inherited from class uk.ac.gla.terrier.structures.DocumentIndex |
---|
close, setIndex |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DocumentIndexEncoded(java.lang.String path, java.lang.String prefix)
public DocumentIndexEncoded()
public DocumentIndexEncoded(java.lang.String filename)
filename
- String The filename of the document index file.Method Detail |
---|
public void setDocnoEntryLength(int l)
setDocnoEntryLength
in class DocumentIndex
public void print()
print
in class DocumentIndex
public int getDocumentId(java.lang.String docno)
getDocumentId
in class DocumentIndex
docno
- java.lang.String The document's number
public int getDocumentLength(int docid)
getDocumentLength
in class DocumentIndex
docid
- the document's id
public int getDocumentLength(java.lang.String docno)
getDocumentLength
in class DocumentIndex
docno
- java.lang.String The document's number
public java.lang.String getDocumentNumber(int docid)
getDocumentNumber
in class DocumentIndex
docid
- int The documents id
public FilePosition getDirectIndexEndOffset()
getDirectIndexEndOffset
in class DocumentIndex
public int getNumberOfDocuments()
getNumberOfDocuments
in class DocumentIndex
public FilePosition getDirectIndexStartOffset()
getDirectIndexStartOffset
in class DocumentIndex
public void loadIntoMemory(java.io.DataInputStream dis, int numOfEntries) throws java.io.IOException
dis
- java.io.DataInputStream The input stream from
which the data are readnumOfEntries
- int The number of entries to read
java.io.IOException
- An input/output exception is
thrown if there any error while reading from disk.public boolean seek(int i)
seek
in class DocumentIndex
i
- the docid of the document we are looking for.
public boolean seek(java.lang.String docno)
seek
in class DocumentIndex
docno
- String the document number of the document we are seeking.
public static void main(java.lang.String[] args)
args
- java.lang.String[] the command line parameters
|
Terrier IR Platform 2.2.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |