Package org.terrier.structures.indexing
Class DocumentIndexBuilder
- java.lang.Object
-
- org.terrier.structures.indexing.DocumentIndexBuilder
-
public class DocumentIndexBuilder extends java.lang.Object
A builder for the document index.- Author:
- Vassilis Plachouras
-
-
Field Summary
Fields Modifier and Type Field Description protected java.io.DataOutputStream
dos
The stream to which we write the data.protected boolean
fields
does this index have fieldsprotected FSArrayFile.ArrayFileWriter
fileWriter
utility for writing to diskprotected IndexOnDisk
index
index object of the index currently being createdprotected static org.slf4j.Logger
logger
The logger usedprotected int
numberOfDocumentIndexEntries
The total number of entries in the document index.protected java.lang.String
structureName
Name of the structure to which we're writing
-
Constructor Summary
Constructors Constructor Description DocumentIndexBuilder(IndexOnDisk i, java.lang.String _structureName)
Deprecated.DocumentIndexBuilder(IndexOnDisk i, java.lang.String _structureName, boolean fields)
Construct a DocumentIndex associated with the specified index
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addEntryToBuffer(org.apache.hadoop.io.Writable die)
Adds to the index a new entry, giving to it the next available document id.void
close()
Closes the random access file.void
finishedCollections()
Closes the underlying file after finished processing the collections.
-
-
-
Field Detail
-
logger
protected static final org.slf4j.Logger logger
The logger used
-
structureName
protected java.lang.String structureName
Name of the structure to which we're writing
-
dos
protected java.io.DataOutputStream dos
The stream to which we write the data.
-
numberOfDocumentIndexEntries
protected int numberOfDocumentIndexEntries
The total number of entries in the document index.
-
index
protected IndexOnDisk index
index object of the index currently being created
-
fields
protected boolean fields
does this index have fields
-
fileWriter
protected FSArrayFile.ArrayFileWriter fileWriter
utility for writing to disk
-
-
Constructor Detail
-
DocumentIndexBuilder
public DocumentIndexBuilder(IndexOnDisk i, java.lang.String _structureName, boolean fields)
Construct a DocumentIndex associated with the specified index- Parameters:
i
- Index being constructed_structureName
- the name of the structure being createdfields
- does this index have fields
-
DocumentIndexBuilder
@Deprecated public DocumentIndexBuilder(IndexOnDisk i, java.lang.String _structureName)
Deprecated.
-
-
Method Detail
-
addEntryToBuffer
public void addEntryToBuffer(org.apache.hadoop.io.Writable die) throws java.io.IOException
Adds to the index a new entry, giving to it the next available document id.- Parameters:
die
- The document index entry being written- Throws:
java.io.IOException
- Throws an exception in the case of an IO error.
-
close
public void close()
Closes the random access file.
-
finishedCollections
public void finishedCollections()
Closes the underlying file after finished processing the collections.
-
-