org.terrier.structures.indexing.singlepass
Class Posting

java.lang.Object
  extended by org.terrier.structures.indexing.singlepass.Posting
Direct Known Subclasses:
BlockPosting, FieldPosting

public class Posting
extends java.lang.Object

Class representing a simple posting list in memory. It keeps the information for TF, Nt, and the sequence [doc, tf]

Author:
Roi Blanco

Field Summary
protected  MemorySBOS docIds
          The compressed in-memory object holding the sequence doc_id, idf
protected  int lastInt
          Last document inserted in the posting
protected  int Nt
          The document frequency
protected  int TF
          The term frequency
 
Constructor Summary
Posting()
           
 
Method Summary
 int getDocF()
           
 MemorySBOS getDocs()
           
 int getSize()
          Returns the size of the underlying buffer representing this posting set.
 int getTF()
           
 int insert(int doc, int freq)
          Inserts a new document in the posting list.
 void setDocF(int docF)
          Set the document frequency the number of documents this term occurs in.
 void setDocs(MemorySBOS docs)
          Sets the document data compressed object.
 void setTF(int tf)
          Sets the term frequency in the run.
 int writeFirstDoc(int docId, int freq)
          Writes the first document in the posting list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TF

protected int TF
The term frequency


Nt

protected int Nt
The document frequency


docIds

protected MemorySBOS docIds
The compressed in-memory object holding the sequence doc_id, idf


lastInt

protected int lastInt
Last document inserted in the posting

Constructor Detail

Posting

public Posting()
Method Detail

writeFirstDoc

public int writeFirstDoc(int docId,
                         int freq)
                  throws java.io.IOException
Writes the first document in the posting list.

Parameters:
docId - the document identifier.
freq - the frequency of the term in the document.
Returns:
the number of bytes consumed in the buffer
Throws:
java.io.IOException - if an I/O error ocurrs.

insert

public int insert(int doc,
                  int freq)
           throws java.io.IOException
Inserts a new document in the posting list. Document insertions must be done in order.

Parameters:
doc - the document identifier.
freq - the frequency of the term in the document.
Returns:
the number of bytes consumed in the buffer
Throws:
java.io.IOException - if and I/O error occurs.

getTF

public int getTF()
Returns:
the term frequency of the term in the run

getDocs

public MemorySBOS getDocs()
Returns:
the document data compressed object.

setTF

public void setTF(int tf)
Sets the term frequency in the run.

Parameters:
tf - the term frequency.

setDocs

public void setDocs(MemorySBOS docs)
Sets the document data compressed object.

Parameters:
docs -

getDocF

public int getDocF()
Returns:
the document frequency - the number of documents this term occurs in

setDocF

public void setDocF(int docF)
Set the document frequency the number of documents this term occurs in.

Parameters:
docF - the document frequency.

getSize

public int getSize()
Returns the size of the underlying buffer representing this posting set.



Terrier 3.5. Copyright © 2004-2011 University of Glasgow