com.sun.labs.minion.indexer.dictionary
Class CachedTermStatsDictionary

java.lang.Object
  extended by com.sun.labs.minion.indexer.dictionary.DiskDictionary
      extended by com.sun.labs.minion.indexer.dictionary.CachedDiskDictionary
          extended by com.sun.labs.minion.indexer.dictionary.CachedTermStatsDictionary
All Implemented Interfaces:
Closeable, Dictionary, TermStatsDictionary, java.lang.Iterable<QueryEntry>

public class CachedTermStatsDictionary
extends CachedDiskDictionary
implements TermStatsDictionary


Nested Class Summary
 
Nested classes/interfaces inherited from class com.sun.labs.minion.indexer.dictionary.DiskDictionary
DiskDictionary.DiskDictionaryIterator, DiskDictionary.HE, DiskDictionary.LightDiskDictionaryIterator, DiskDictionary.LookupState
 
Field Summary
static int BUFFER_SIZE
           
static java.lang.String logTag
           
 
Fields inherited from class com.sun.labs.minion.indexer.dictionary.DiskDictionary
CHANNEL_FULL_POST, CHANNEL_PART_POST, decoder, dh, dictFile, entryClass, entryInfo, entryInfoOffsets, FILE_FULL_POST, FILE_PART_POST, idToPosn, nameCache, nameOffsets, names, nLoads, part, posnCache, postFiles, postIn, totalSize
 
Constructor Summary
CachedTermStatsDictionary(java.io.File df)
          Creates a term statistics dictinary
 
Method Summary
 boolean close(long currTime)
          Close this thing.
static void create(java.lang.String indexDir, java.io.File df)
          Creates an empty term stats dictionary.
 void createRemoveFile()
           
 long getCloseTime()
           
 TermStatsEntry getTermStats(java.lang.String term)
          Gets the term statistics associated with the give term.
 void iterationDone()
          Indicates that a reference counted iterator for this dictionary is no longer in use, so a reference may be removed.
 DictionaryIterator iterator()
          Gets an iterator and keeps a count of extant references to the dictionary, so that we know when a dictionary is no longer in use.
 DictionaryIterator iterator(boolean ref)
          Gets an iterator.
 void setCloseTime(long closeTime)
           
 
Methods inherited from class com.sun.labs.minion.indexer.dictionary.CachedDiskDictionary
get, get, iterator
 
Methods inherited from class com.sun.labs.minion.indexer.dictionary.DiskDictionary
customSetup, find, findPos, findPos, get, get, getBufferedInputs, getBufferedInputs, getLookupState, getMatching, getMaxID, getPartition, getSpellingVariants, getStemMatches, getSubstring, iterator, iterator, literator, merge, merge, newEntry, newEntry, put, remapPostings, setCacheSize, setPartition, setUpBuffers, size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.sun.labs.minion.indexer.dictionary.TermStatsDictionary
size
 

Field Detail

BUFFER_SIZE

public static int BUFFER_SIZE

logTag

public static final java.lang.String logTag
See Also:
Constant Field Values
Constructor Detail

CachedTermStatsDictionary

public CachedTermStatsDictionary(java.io.File df)
                          throws java.io.IOException
Creates a term statistics dictinary

Parameters:
df - the file from which the terms statistics dictionary will be read
Throws:
java.io.IOException - if there is any error opening the dictionary
Method Detail

getTermStats

public TermStatsEntry getTermStats(java.lang.String term)
Description copied from interface: TermStatsDictionary
Gets the term statistics associated with the give term.

Specified by:
getTermStats in interface TermStatsDictionary
Returns:
the term statistics associated with the given term, or null if that term does not occur in the index

setCloseTime

public void setCloseTime(long closeTime)
Specified by:
setCloseTime in interface Closeable

getCloseTime

public long getCloseTime()
Specified by:
getCloseTime in interface Closeable

createRemoveFile

public void createRemoveFile()
Specified by:
createRemoveFile in interface Closeable

close

public boolean close(long currTime)
Description copied from interface: Closeable
Close this thing.

Specified by:
close in interface Closeable
Parameters:
currTime - the current time. If the time that the thing is supposed to be closed is before the current time, then it will be closed.
Returns:
true if the thing was closed, false otherwise.

create

public static void create(java.lang.String indexDir,
                          java.io.File df)
Creates an empty term stats dictionary.

Parameters:
indexDir - the directory where the term statistics dictionary should be created
df - the file that should be created for the dictionary

iterator

public DictionaryIterator iterator(boolean ref)
Gets an iterator.

Specified by:
iterator in interface TermStatsDictionary
Parameters:
ref - if true then we will keep a reference count for this dictionary so that we don't close the file while it's in use. If false this dictionary may be closed during iteration.
Returns:
an iterator for this dictionary
See Also:
TermStatsDictionary.iterationDone()

iterator

public DictionaryIterator iterator()
Gets an iterator and keeps a count of extant references to the dictionary, so that we know when a dictionary is no longer in use.

Specified by:
iterator in interface Dictionary
Specified by:
iterator in interface TermStatsDictionary
Specified by:
iterator in interface java.lang.Iterable<QueryEntry>
Overrides:
iterator in class CachedDiskDictionary
Returns:
an iterator for the dictionary. The elements of the iterator implement the Map.Entry interface

iterationDone

public void iterationDone()
Description copied from interface: TermStatsDictionary
Indicates that a reference counted iterator for this dictionary is no longer in use, so a reference may be removed.

Specified by:
iterationDone in interface TermStatsDictionary