Package org.terrier.structures
Class FSADocumentIndex
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<V>
-
- org.terrier.structures.collections.FSArrayFile<DocumentIndexEntry>
-
- org.terrier.structures.FSADocumentIndex
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,java.lang.Iterable<DocumentIndexEntry>
,java.util.Collection<DocumentIndexEntry>
,java.util.List<DocumentIndexEntry>
,DocumentIndex
- Direct Known Subclasses:
FSAFieldDocumentIndex
public class FSADocumentIndex extends FSArrayFile<DocumentIndexEntry> implements DocumentIndex
Document Index saved as a fixed size array
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FSADocumentIndex.FSADocumentIndexIterator
Gets an iterator over the documents in this index-
Nested classes/interfaces inherited from class org.terrier.structures.collections.FSArrayFile
FSArrayFile.ArrayFileIterator<V extends org.apache.hadoop.io.Writable>, FSArrayFile.ArrayFileWriter
-
-
Field Summary
Fields Modifier and Type Field Description protected int[]
docLengths
protected int
lastDocid
protected DocumentIndexEntry
lastEntry
protected static org.slf4j.Logger
logger
-
Fields inherited from class org.terrier.structures.collections.FSArrayFile
dataFile, dataFilename, entrySize, numberOfEntries, USUAL_EXTENSION, valueFactory
-
-
Constructor Summary
Constructors Modifier Constructor Description FSADocumentIndex(IndexOnDisk index, java.lang.String structureName)
Construct an instance of the class withprotected
FSADocumentIndex(IndexOnDisk index, java.lang.String structureName, boolean initialise)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DocumentIndexEntry
getDocumentEntry(int docid)
Return the document index entry based on its docid.int
getDocumentLength(int docid)
Return the length of the document.int
getNumberOfDocuments()
Return the number of documents.protected void
initialise(IndexOnDisk index, java.lang.String structureName)
-
Methods inherited from class org.terrier.structures.collections.FSArrayFile
close, get, iterator, size, writeFSArrayFile
-
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, hashCode, indexOf, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
-
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
-
-
-
-
Field Detail
-
logger
protected static final org.slf4j.Logger logger
-
lastDocid
protected int lastDocid
-
lastEntry
protected DocumentIndexEntry lastEntry
-
docLengths
protected int[] docLengths
-
-
Constructor Detail
-
FSADocumentIndex
public FSADocumentIndex(IndexOnDisk index, java.lang.String structureName) throws java.io.IOException
Construct an instance of the class with- Parameters:
index
-structureName
-- Throws:
java.io.IOException
-
FSADocumentIndex
protected FSADocumentIndex(IndexOnDisk index, java.lang.String structureName, boolean initialise) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
initialise
protected void initialise(IndexOnDisk index, java.lang.String structureName) throws java.io.IOException
- Throws:
java.io.IOException
-
getDocumentLength
public final int getDocumentLength(int docid) throws java.io.IOException
Return the length of the document.- Specified by:
getDocumentLength
in interfaceDocumentIndex
- Returns:
- the length of the document.
- Throws:
java.io.IOException
-
getDocumentEntry
public final DocumentIndexEntry getDocumentEntry(int docid) throws java.io.IOException
Return the document index entry based on its docid.- Specified by:
getDocumentEntry
in interfaceDocumentIndex
- Returns:
- the document index entry based on its docid.
- Throws:
java.io.IOException
-
getNumberOfDocuments
public int getNumberOfDocuments()
Return the number of documents.- Specified by:
getNumberOfDocuments
in interfaceDocumentIndex
- Returns:
- the number of documents.
-
-