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

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.CasedIDEntry
All Implemented Interfaces:
CasedPostingsEntry, Entry, IndexEntry, QueryEntry, java.lang.Comparable

public class CasedIDEntry
extends CasedEntry

A class for storing ID only postings for dictionary entries that need to store case sensitive and case insensitive postings. Such entries can be used for bigram dictionaries or for character saved fields that need to be searched case insensitively.


Field Summary
protected static int CI
           
protected static int CS
           
 
Fields inherited from class com.sun.labs.minion.indexer.entry.CasedEntry
ciEntry, logTag, n, offset, p, size, totalSize
 
Fields inherited from class com.sun.labs.minion.indexer.entry.BaseEntry
dict, id, name, postIn
 
Constructor Summary
CasedIDEntry()
          Creates an entry of this type with no name.
CasedIDEntry(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.
 Postings getCaseInsensitivePostings()
          Gets the postings that are case insenstive.
 Postings getCaseSensitivePostings()
          Gets the postings that are case sensitive.
 Entry getEntry(java.lang.Object name)
          Gets a new entry with the given name.
 int getMaxFDT()
          Returns the maximum frequency encoded in the postings, which is always 1 for ID only postings.
 int getN()
          Gets the number of postings associated with this entry.
 int getNCaseInsensitive()
           
 int getNumChannels()
          Returns the number of channels needed to store the postings for this entry type.
 long getTotalOccurrences()
          Returns the total number of occurrences for these postings, which is just the number of postings for ID only 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, encodePostingsInfo, getCaseInsensitiveEntry, getEntry, 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
Constructor Detail

CasedIDEntry

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


CasedIDEntry

public CasedIDEntry(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.

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.

getNumChannels

public int getNumChannels()
Returns the number of channels needed to store the postings for this entry type.

Specified by:
getNumChannels in interface Entry
Overrides:
getNumChannels in class CasedEntry

getMaxFDT

public int getMaxFDT()
Returns the maximum frequency encoded in the postings, which is always 1 for ID only postings.


getTotalOccurrences

public long getTotalOccurrences()
Returns the total number of occurrences for these postings, which is just the number of postings for ID only postings.

Returns:
The total number of occurrences associated with 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.

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)
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. These postings will be unfielded.

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.

getNCaseInsensitive

public int getNCaseInsensitive()