public class MemoryPostings extends Object
Modifier and Type | Field and Description |
---|---|
protected long |
keyBytes |
protected static org.apache.log4j.Logger |
logger
logger to use in this class
|
protected int |
maxSize
The number of documents for any term in this run
|
protected long |
numPointers
Number of pointers (
|
protected Map<String,Posting> |
postings
Hashmap indexed by the term, containing the posting lists
|
protected long |
valueBytes |
Constructor and Description |
---|
MemoryPostings() |
Modifier and Type | Method and Description |
---|---|
void |
add(String term,
int doc,
int frequency)
Adds an occurrence of a term in a document to the posting in memory.
|
void |
addTerms(DocumentPostingList docPostings,
int docid)
Add the terms in a DocumentPostingList to the postings in memory.
|
void |
finish(RunWriter runWriter)
Triggers the writing of the postings in memory to the specified
RunWriter.
|
void |
finish(String[] file)
Triggers the writing of the postings in memory to disk.
|
long |
getMemoryConsumption()
Returns the number of bytes consumed by this set of postings
|
long |
getPointers()
Returns the number of pointers in this posting list.
|
int |
getSize()
Returns the number of terms in this posting list.
|
protected static final org.apache.log4j.Logger logger
protected Map<String,Posting> postings
protected int maxSize
protected long numPointers
protected long keyBytes
protected long valueBytes
public void addTerms(DocumentPostingList docPostings, int docid) throws IOException
docPostings
- DocumentPostingList containing the term information for the denoted document.docid
- Current document Identifier.IOException
- if an I/O error occurs.public void add(String term, int doc, int frequency) throws IOException
term
- String representing the term.doc
- int containing the document identifier.frequency
- int containing the frequency of the term in the document.IOException
- if an I/O error occurs.public void finish(String[] file) throws IOException
file
- name of the file to write the postings.IOException
- if an I/O error occurs.public void finish(RunWriter runWriter) throws IOException
runWriter
- IOException
public int getSize()
public long getMemoryConsumption()
public long getPointers()
Terrier 4.0. Copyright © 2004-2014 University of Glasgow