|
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.DocumentIndexInMemory
public class DocumentIndexInMemory
This class extends DocumentIndex, but instead of accessing the disk file each time, the data are loaded into memory, in order to decrease access time.
Field Summary |
---|
Fields inherited from class uk.ac.gla.terrier.structures.DocumentIndex |
---|
entryLength |
Constructor Summary | |
---|---|
DocumentIndexInMemory()
The default constructor for DocumentIndexInMemory. |
|
DocumentIndexInMemory(java.lang.String filename)
A constructor for DocumentIndexInMemory that specifies the file to open. |
|
DocumentIndexInMemory(java.lang.String path,
java.lang.String prefix)
|
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. |
void |
loadIntoMemory(java.io.DataInputStream dis,
int numOfEntries)
This method loads the data into memory. |
void |
print()
Prints to the standard error the document index structure, which is loaded into memory. |
boolean |
seek(int i)
This method overrides the seek(int docid) method of DocumentIndex 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, main, seek, setIndex |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DocumentIndexInMemory()
public DocumentIndexInMemory(java.lang.String filename)
filename
- java.lang.Stringpublic DocumentIndexInMemory(java.lang.String path, java.lang.String prefix)
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 read,numOfEntries
- int The number of entries to read
java.io.IOException
- An input/output exception
is thrown if there is 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.
|
Terrier IR Platform 2.2.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |