org.apache.lucene.search.suggest.tst
Class TSTLookup

java.lang.Object
  extended by org.apache.lucene.search.suggest.Lookup
      extended by org.apache.lucene.search.suggest.tst.TSTLookup

public class TSTLookup
extends Lookup


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.lucene.search.suggest.Lookup
Lookup.LookupPriorityQueue, Lookup.LookupResult
 
Field Summary
static String FILENAME
           
 
Constructor Summary
TSTLookup()
           
 
Method Summary
 boolean add(String key, Object value)
          Modify the lookup data by recording additional data.
 void build(TermFreqIterator tfit)
           
 Object get(String key)
          Get value associated with a specific key.
 boolean load(File storeDir)
          Discard current lookup data and load it from a previously saved copy.
 List<Lookup.LookupResult> lookup(String key, boolean onlyMorePopular, int num)
          Look up a key and return possible completion for this key.
 boolean store(File storeDir)
          Persist the constructed lookup data to a directory.
 
Methods inherited from class org.apache.lucene.search.suggest.Lookup
build
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILENAME

public static final String FILENAME
See Also:
Constant Field Values
Constructor Detail

TSTLookup

public TSTLookup()
Method Detail

build

public void build(TermFreqIterator tfit)
           throws IOException
Specified by:
build in class Lookup
Throws:
IOException

add

public boolean add(String key,
                   Object value)
Description copied from class: Lookup
Modify the lookup data by recording additional data. Optional operation.

Specified by:
add in class Lookup
Parameters:
key - new lookup key
value - value to associate with this key
Returns:
true if new key is added, false if it already exists or operation is not supported.

get

public Object get(String key)
Description copied from class: Lookup
Get value associated with a specific key.

Specified by:
get in class Lookup
Parameters:
key - lookup key
Returns:
associated value

lookup

public List<Lookup.LookupResult> lookup(String key,
                                        boolean onlyMorePopular,
                                        int num)
Description copied from class: Lookup
Look up a key and return possible completion for this key.

Specified by:
lookup in class Lookup
Parameters:
key - lookup key. Depending on the implementation this may be a prefix, misspelling, or even infix.
onlyMorePopular - return only more popular results
num - maximum number of results to return
Returns:
a list of possible completions, with their relative weight (e.g. popularity)

load

public boolean load(File storeDir)
             throws IOException
Description copied from class: Lookup
Discard current lookup data and load it from a previously saved copy. Optional operation.

Specified by:
load in class Lookup
Parameters:
storeDir - directory where lookup data was stored.
Returns:
true if completed successfully, false if unsuccessful or not supported.
Throws:
IOException - when fatal IO error occurs.

store

public boolean store(File storeDir)
              throws IOException
Description copied from class: Lookup
Persist the constructed lookup data to a directory. Optional operation.

Specified by:
store in class Lookup
Parameters:
storeDir - directory where data can be stored.
Returns:
true if successful, false if unsuccessful or not supported.
Throws:
IOException - when fatal IO error occurs.


Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.