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

java.lang.Object
  extended by com.sun.labs.minion.indexer.entry.BaseEntry
      extended by com.sun.labs.minion.indexer.entry.CasedEntry
          extended by com.sun.labs.minion.indexer.entry.CasedDFOEntry
All Implemented Interfaces:
CasedPostingsEntry, Entry, IndexEntry, QueryEntry, java.lang.Comparable
Direct Known Subclasses:
MPCasedDFOEntry

public class CasedDFOEntry
extends CasedEntry


Field Summary
protected static int CI
           
protected static int CS
           
protected  int[] fnpSize
          The sizes of the data including fields and positions data.
protected static java.lang.String logTag
           
protected  int[] maxfdt
          The maximum term frequencies.
protected  long[] to
          The total number of occurrences.
 
Fields inherited from class com.sun.labs.minion.indexer.entry.CasedEntry
ciEntry, n, offset, p, size, totalSize
 
Fields inherited from class com.sun.labs.minion.indexer.entry.BaseEntry
dict, id, name, postIn
 
Constructor Summary
CasedDFOEntry()
          Creates an entry of this type with no name.
CasedDFOEntry(java.lang.Object name)
          Creates an entry of this type.
 
Method Summary
 void addCaseInsensitive(Occurrence o)
          Adds an occurrence to the case insensitive postings for this entry.
 void addCaseSensitive(Occurrence o)
          Adds an occurrence to the case sensitive postings for this 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.
 Postings getCaseInsensitivePostings()
          Gets the postings that are case insenstive.
 Postings getCaseSensitivePostings()
          Gets the postings that are case sensitive.
 Entry getEntry()
          Duplicates the contents of this entry, except for any postings.
 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 fdt value from these postings.
 int getN()
          Gets the number of postings associated with this entry.
 long getTotalOccurrences()
          Gets the total number of occurrences in these postings.
 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.
protected  void init()
          Initializes the arrays containing postings, sizes, etc.
protected  void initPostings(int pos)
          Creates a set of postings for indexing or merging.
 PostingsIterator iterator(PostingsIteratorFeatures features)
          Gets an iterator that will iterate through a set of postings associated with this entry.
 boolean nameOccurred()
          Indicates whether the name of this entry actually occurred in the data, that is, whether it has any case sensitive postings.
 void readPostings()
          Reads the postings data for this entry.
 void readPostings(int pos)
          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.CasedEntry
add, add, getCaseInsensitiveEntry, getNumChannels, setCaseInsensitiveEntry
 
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

CS

protected static final int CS
See Also:
Constant Field Values

CI

protected static final int CI
See Also:
Constant Field Values

logTag

protected static java.lang.String logTag

maxfdt

protected int[] maxfdt
The maximum term frequencies.


to

protected long[] to
The total number of occurrences.


fnpSize

protected int[] fnpSize
The sizes of the data including fields and positions data.

Constructor Detail

CasedDFOEntry

public CasedDFOEntry()
Creates an entry of this type with no name.


CasedDFOEntry

public CasedDFOEntry(java.lang.Object name)
Creates an entry of this type.

Parameters:
name - The name of the entry.
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()
Duplicates the contents of this entry, except for any postings.

Specified by:
getEntry in interface Entry
Overrides:
getEntry in class CasedEntry
Returns:
a new entry.

init

protected void init()
Description copied from class: CasedEntry
Initializes the arrays containing postings, sizes, etc.

Specified by:
init in class CasedEntry

initPostings

protected void initPostings(int pos)
Creates a set of postings for indexing or merging.

Specified by:
initPostings in class CasedEntry
Parameters:
pos - The position in the array of postings where we'll start creating postings.

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.

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 CasedEntry
Parameters:
b - The buffer onto which the postings information should be encoded. The buffer will be positioned to the correct spot for the encoding.

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.

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.

getMaxFDT

public int getMaxFDT()
Gets the maximum fdt value from these postings. We'll take the value from the case insensitive postings, if we have them.


getTotalOccurrences

public long getTotalOccurrences()
Gets the total number of occurrences in these postings. We'll take the value from the case insensitive postings, if we have them.

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

append

public void append(QueryEntry qe,
                   int start,
                   int[] idMap)
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.

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 CasedEntry
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(int pos)
                  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.

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

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.

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

getN

public int getN()
Gets the number of postings associated with this entry. This is used to sort entries by their frequency during query operations.

Returns:
The number of postings associated with this entry.

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)
Gets an iterator that will iterate through a set of postings associated with this entry.

Parameters:
features - The features that the iterator must support
Returns:
An iterator for the postings.

addCaseSensitive

public void addCaseSensitive(Occurrence o)
Adds an occurrence to the case sensitive postings for this entry.

Parameters:
o - The occurrence to add.

addCaseInsensitive

public void addCaseInsensitive(Occurrence o)
Adds an occurrence to the case insensitive postings for this entry.

Parameters:
o - The occurrence to add.

getCaseSensitivePostings

public Postings getCaseSensitivePostings()
Gets the postings that are case sensitive.

Returns:
the postings associated with the case sensitive entry

getCaseInsensitivePostings

public Postings getCaseInsensitivePostings()
Gets the postings that are case insenstive.

Returns:
the postings associated with the case insensitive entry

nameOccurred

public boolean nameOccurred()
Indicates whether the name of this entry actually occurred in the data, that is, whether it has any case sensitive postings.

Returns:
true if the name of this entry actually occurred in the indexed material, false otherwise.