Terrier IR Platform
2.2.1

uk.ac.gla.terrier.structures.indexing.singlepass
Class MemoryPostings

java.lang.Object
  extended by uk.ac.gla.terrier.structures.indexing.singlepass.MemoryPostings
Direct Known Subclasses:
BlockMemoryPostings, FieldsMemoryPostings

public class MemoryPostings
extends java.lang.Object

Class for handling Simple posting lists in memory while indexing.

Author:
Roi Blanco

Constructor Summary
MemoryPostings()
           
 
Method Summary
 void add(java.lang.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(java.lang.String[] file)
          Triggers the writing of the postings in memory to disk.
 long getPointers()
          Returns the number of pointers in this posting list.
 int getSize()
          Returns the number of terms in this posting list.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MemoryPostings

public MemoryPostings()
Method Detail

addTerms

public void addTerms(DocumentPostingList docPostings,
                     int docid)
              throws java.io.IOException
Add the terms in a DocumentPostingList to the postings in memory.

Parameters:
docPostings - DocumentPostingList containing the term information for the denoted document.
docid - Current document Identifier.
Throws:
java.io.IOException - if an I/O error occurs.

add

public void add(java.lang.String term,
                int doc,
                int frequency)
         throws java.io.IOException
Adds an occurrence of a term in a document to the posting in memory.

Parameters:
term - String representing the term.
doc - int containing the document identifier.
frequency - int containing the frequency of the term in the document.
Throws:
java.io.IOException - if an I/O error occurs.

finish

public void finish(java.lang.String[] file)
            throws java.io.IOException
Triggers the writing of the postings in memory to disk. Uses the default RunWriter, writing to the specified files.

Parameters:
file - name of the file to write the postings.
Throws:
java.io.IOException - if an I/O error occurs.

finish

public void finish(RunWriter runWriter)
            throws java.io.IOException
Triggers the writing of the postings in memory to the specified RunWriter. If the RunWriter requires that terms are written in order, then this will happen.

Parameters:
runWriter -
Throws:
java.io.IOException

getSize

public int getSize()
Returns the number of terms in this posting list.

Returns:
the number of posting lists in memory.

getPointers

public long getPointers()
Returns the number of pointers in this posting list. Pointers are unique (term,docid) tuples.

Returns:
the number of pointers in memory.

Terrier IR Platform
2.2.1

Terrier Information Retrieval Platform 2.2.1. Copyright 2004-2008 University of Glasgow