org.terrier.structures.postings
Class ORIterablePosting

java.lang.Object
  extended by org.terrier.structures.postings.IterablePostingImpl
      extended by org.terrier.structures.postings.ORIterablePosting
All Implemented Interfaces:
Closeable, IterablePosting, Posting
Direct Known Subclasses:
BlockORIterablePosting, FieldORIterablePosting

public class ORIterablePosting
extends IterablePostingImpl

An IterablePosting that combines more than one IterablePosting into a single IterablePosting. By doing so, multiple term's posting lists can appear as a singe posting list.

Since:
3.5
Author:
Craig Macdonald
See Also:
FieldORIterablePosting, BlockORIterablePosting, BlockFieldORIterablePosting

Field Summary
 
Fields inherited from interface org.terrier.structures.postings.IterablePosting
EOL
 
Constructor Summary
ORIterablePosting(IterablePosting[] ips)
          Create a Basic ORIterablePosting from the specified postings
 
Method Summary
protected  void addPosting(Posting p)
           
 WritablePosting asWritablePosting()
          Copies this posting to one free of an iterator.
 void close()
          
 boolean endOfPostings()
          Status method to see if this posting list iterator has been finished
protected  void firstPosting(Posting p)
           
 int getDocumentLength()
          Return the length of the document for this posting.
 int getFrequency()
          Return the frequency of the term in the current document
 int getId()
          Return the id of the current posting.
static ORIterablePosting mergePostings(IterablePosting[] ips)
          Factory method to create an appropriate ORIterablePosting from the specified IterablePostings.
 int next()
          Move this iterator to the next posting.
 void setId(int _id)
          It may be of benefit to update the frequency of the id in some applications.
 
Methods inherited from class org.terrier.structures.postings.IterablePostingImpl
next
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ORIterablePosting

public ORIterablePosting(IterablePosting[] ips)
                  throws IOException
Create a Basic ORIterablePosting from the specified postings

Throws:
IOException
Method Detail

mergePostings

public static ORIterablePosting mergePostings(IterablePosting[] ips)
                                       throws IOException
Factory method to create an appropriate ORIterablePosting from the specified IterablePostings. Four types of ORIterablePosting maybe returned, based on the type of the first IterablePosting classes:

Throws:
IOException

endOfPostings

public boolean endOfPostings()
Status method to see if this posting list iterator has been finished

Returns:
true if next() or next(int) would return EOL or have returned EOL.

firstPosting

protected void firstPosting(Posting p)

addPosting

protected void addPosting(Posting p)

next

public int next()
         throws IOException
Move this iterator to the next posting.

Returns:
id of next posting, or EOL if end of posting list
Throws:
IOException

asWritablePosting

public WritablePosting asWritablePosting()
Copies this posting to one free of an iterator. Kind of like a clone.

Returns:
an identical posting, but which can be maniulated free of this iterator

getDocumentLength

public int getDocumentLength()
Return the length of the document for this posting. Usually uses the DocumentIndex, may do otherwise if document length statistics are in posting list

Returns:
length of the document of the current posting in tokens.

getFrequency

public int getFrequency()
Return the frequency of the term in the current document

Returns:
frequency of posting, in tokens

getId

public int getId()
Return the id of the current posting. For the inverted index, this is the docid; for the direct index it corresponds to the term id

Returns:
id of the posting

setId

public void setId(int _id)
It may be of benefit to update the frequency of the id in some applications. This should not be used lightly, as it may break the decompression of other postings in iterators.


close

public void close()
           throws IOException

Throws:
IOException


Terrier 3.6. Copyright © 2004-2011 University of Glasgow