com.sun.labs.minion.indexer.entry
Class DFOEntry

java.lang.Object
  extended by com.sun.labs.minion.indexer.entry.BaseEntry
      extended by com.sun.labs.minion.indexer.entry.SinglePostingsEntry
          extended by com.sun.labs.minion.indexer.entry.DFOEntry
All Implemented Interfaces:
Entry, IndexEntry, QueryEntry, java.lang.Comparable

public class DFOEntry
extends SinglePostingsEntry


Field Summary
protected  int fnpSize
          The size of the data including fields and positions data.
protected  int maxfdt
          The maximum frequency of the term across the documents in the postings list.
protected  long to
          The total number of occurrences in the postings list associated with this entry.
 
Fields inherited from class com.sun.labs.minion.indexer.entry.SinglePostingsEntry
logTag, n, offset, p, size, tsize
 
Fields inherited from class com.sun.labs.minion.indexer.entry.BaseEntry
dict, id, name, postIn
 
Constructor Summary
DFOEntry()
           
DFOEntry(java.lang.Object name)
           
 
Method Summary
 void decodePostingsInfo(ReadableBuffer b, int pos)
          Decodes the postings information associated with this entry.
 void encodePostingsInfo(WriteableBuffer b)
          Encodes any information associated with the postings onto the given buffer.
 Entry getEntry()
          Gets a new entry that contains a copy of the data in this entry.
 Entry getEntry(java.lang.Object name)
          Gets a new entry with the given name.
 IndexEntry getInstance(java.lang.Object name)
          Gets a new instance of the implementing class.
 int getMaxFDT()
          Gets the maximum frequency in the postings associated with this entry.
protected  Postings getPostings()
          Gets the appropriate postings type for the class.
protected  Postings getPostings(ReadableBuffer input)
          Reads the postings for this class, returning a set of postings useful at query time.
 long getTotalOccurrences()
          Gets the total number of occurrences associated with this entry.
 boolean hasFieldInformation()
          Indicates whether the postings associated with this entry have field information.
 boolean hasPositionInformation()
          Indicates whether the postings associated with this entry have position information.
 PostingsIterator iterator(PostingsIteratorFeatures features)
          Gets an iterator that will iterate through a set of postings associated with this entry.
 void readPostings()
          Reads the postings data for this entry.
 boolean writePostings(PostingsOutput[] out, int[] idMap)
          Writes the postings associated with this entry to some or all of the given channels.
 
Methods inherited from class com.sun.labs.minion.indexer.entry.SinglePostingsEntry
add, append, copyData, getN, getNumChannels
 
Methods inherited from class com.sun.labs.minion.indexer.entry.BaseEntry
compareTo, getID, getName, getPartition, setDictionary, setID, setName, setPostingsInput, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

to

protected long to
The total number of occurrences in the postings list associated with this entry.


maxfdt

protected int maxfdt
The maximum frequency of the term across the documents in the postings list.


fnpSize

protected int fnpSize
The size of the data including fields and positions data.

Constructor Detail

DFOEntry

public DFOEntry()

DFOEntry

public DFOEntry(java.lang.Object name)
Method Detail

getEntry

public Entry getEntry(java.lang.Object name)
Description copied from interface: Entry
Gets a new entry with the given name.

Parameters:
name - the name that we want to give the entry.
Returns:
a new entry.

getEntry

public Entry getEntry()
Gets a new entry that contains a copy of the data in this entry.

Specified by:
getEntry in interface Entry
Overrides:
getEntry in class SinglePostingsEntry
Returns:
a new entry.
Throws:
java.lang.ClassCastException - if the provided entry is not of type DFOEntry

getInstance

public IndexEntry getInstance(java.lang.Object name)
Gets a new instance of the implementing class.

Parameters:
name - The name to give the new instance.

getPostings

protected Postings getPostings()
Gets the appropriate postings type for the class. These postings should be useable for indexing.

Specified by:
getPostings in class SinglePostingsEntry
Returns:
Postings suitable for use when indexing.

getPostings

protected Postings getPostings(ReadableBuffer input)
Reads the postings for this class, returning a set of postings useful at query time.

Specified by:
getPostings in class SinglePostingsEntry
Parameters:
input - The buffer containing the postings read from the postings file.
Returns:
The postings for this entry.

writePostings

public boolean writePostings(PostingsOutput[] out,
                             int[] idMap)
                      throws java.io.IOException
Writes the postings associated with this entry to some or all of the given channels.

Specified by:
writePostings in interface IndexEntry
Overrides:
writePostings in class SinglePostingsEntry
Parameters:
out - The outputs to which we will write the postings.
idMap - A map from the IDs currently used in the postings to the IDs that should be used when the postings are written to disk. This may be null, in which case no remapping will occur.
Returns:
true if postings were written, false otherwise
Throws:
java.io.IOException - if there is any error writing the postings.

encodePostingsInfo

public void encodePostingsInfo(WriteableBuffer b)
Encodes any information associated with the postings onto the given buffer.

Specified by:
encodePostingsInfo in interface IndexEntry
Overrides:
encodePostingsInfo in class SinglePostingsEntry
Parameters:
b - The buffer onto which the postings information should be encoded. The buffer will be positioned to the correct spot for the encoding.

decodePostingsInfo

public void decodePostingsInfo(ReadableBuffer b,
                               int pos)
Decodes the postings information associated with this entry.

Specified by:
decodePostingsInfo in interface QueryEntry
Overrides:
decodePostingsInfo in class SinglePostingsEntry
Parameters:
b - The buffer containing the encoded postings information.
pos - The position in b where the postings information can be found.

readPostings

public void readPostings()
                  throws java.io.IOException
Reads the postings data for this entry. This method must load all available postings information, since this will be used at dictionary merge time to append postings from one entry onto another.

Specified by:
readPostings in interface QueryEntry
Overrides:
readPostings in class SinglePostingsEntry
Throws:
java.io.IOException - if there is any error reading the postings.

getTotalOccurrences

public long getTotalOccurrences()
Gets the total number of occurrences associated with this entry. For this base class, this is the same as n.

Specified by:
getTotalOccurrences in interface Entry
Overrides:
getTotalOccurrences in class SinglePostingsEntry
Returns:
The total number of occurrences associated with this entry.

getMaxFDT

public int getMaxFDT()
Gets the maximum frequency in the postings associated with this entry. For this base class, this is always 1.

Specified by:
getMaxFDT in interface Entry
Overrides:
getMaxFDT in class SinglePostingsEntry

hasPositionInformation

public boolean hasPositionInformation()
Description copied from interface: QueryEntry
Indicates whether the postings associated with this entry have position information.

Specified by:
hasPositionInformation in interface QueryEntry
Overrides:
hasPositionInformation in class SinglePostingsEntry

hasFieldInformation

public boolean hasFieldInformation()
Description copied from interface: QueryEntry
Indicates whether the postings associated with this entry have field information.

Specified by:
hasFieldInformation in interface QueryEntry
Overrides:
hasFieldInformation in class SinglePostingsEntry

iterator

public PostingsIterator iterator(PostingsIteratorFeatures features)
Gets an iterator that will iterate through a set of postings associated with this entry.

Specified by:
iterator in interface QueryEntry
Overrides:
iterator in class SinglePostingsEntry
Parameters:
features - The features that the iterator must support
Returns:
An iterator for the postings.