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

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

public class TermStatsEntry
extends BaseEntry

An entry for the global term statistics dictionary. These entries will not have any postings.


Field Summary
 
Fields inherited from class com.sun.labs.minion.indexer.entry.BaseEntry
dict, id, name, postIn
 
Constructor Summary
TermStatsEntry()
           
TermStatsEntry(java.lang.String name)
           
 
Method Summary
 void add(Occurrence o)
          Adds an occurrence to this index entry.
 void append(QueryEntry qe, int start, int[] idMap)
          Appends the postings from another entry onto this one.
 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.
 int getMaxFDT()
          Gets the maximum document term frequency from this entry.
 int getN()
          Gets the number of postings associated with this entry.
 int getNumChannels()
          Returns the number of channels needed to store or retrieve the postings for this entry type.
 TermStatsImpl getTermStats()
           
 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 the postings associated with this entry.
 void readPostings()
          Reads the postings data for this entry.
 void setTermStats(TermStatsImpl ts)
           
 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.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
 

Constructor Detail

TermStatsEntry

public TermStatsEntry()

TermStatsEntry

public TermStatsEntry(java.lang.String name)
Method Detail

setTermStats

public void setTermStats(TermStatsImpl ts)

getTermStats

public TermStatsImpl getTermStats()

add

public void add(Occurrence o)
Description copied from interface: IndexEntry
Adds an occurrence to this index entry.

Parameters:
o - The occurrence to add.

writePostings

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

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.

append

public void append(QueryEntry qe,
                   int start,
                   int[] idMap)
Description copied from interface: IndexEntry
Appends the postings from another entry onto this one. This is used when merging dictionaries.

Parameters:
qe - The entry that we want to append onto this one.
start - The new starting ID for the partition that the entry was drawn from.
idMap - A map from old IDs in the given postings to new IDs with gaps removed for deleted data. If this is null, then there are no deleted documents.

encodePostingsInfo

public void encodePostingsInfo(WriteableBuffer b)
Description copied from interface: IndexEntry
Encodes any information associated with the postings onto the given buffer.

Parameters:
b - The buffer onto which the postings information should be encoded. The buffer will be positioned to the correct spot for the encoding.

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()
Description copied from interface: Entry
Gets a new entry that contains a copy of the data in this entry.

Returns:
a new entry.

getN

public int getN()
Description copied from interface: Entry
Gets the number of postings associated with this entry. This can be used to sort entries by their frequency during query operations.

Returns:
The number of postings associated with this entry.

getTotalOccurrences

public long getTotalOccurrences()
Description copied from interface: Entry
Gets the total number of occurrences associated with this entry. This is useful when a single postings entry may comprise multiple occurrences.

At the moment, this is only really useful for entries from the main dictionary for a partition.

Returns:
The total number of occurrences associated with this entry.

getMaxFDT

public int getMaxFDT()
Description copied from interface: Entry
Gets the maximum document term frequency from this entry. For all IDs asssociated with this entry, this is the maximum frequency across all the IDs.


getNumChannels

public int getNumChannels()
Description copied from interface: Entry
Returns the number of channels needed to store or retrieve the postings for this entry type.


decodePostingsInfo

public void decodePostingsInfo(ReadableBuffer b,
                               int pos)
Description copied from interface: QueryEntry
Decodes the postings information associated with this entry.

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
Description copied from interface: QueryEntry
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.

Throws:
java.io.IOException - if there is any error reading the postings.

hasPositionInformation

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


hasFieldInformation

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


iterator

public PostingsIterator iterator(PostingsIteratorFeatures features)
Description copied from interface: QueryEntry
Gets an iterator that will iterate through the postings associated with this entry.

Parameters:
features - A set of features that the iterator must support.
Returns:
An iterator for the postings.