|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.lucene.search.suggest.Lookup
public abstract class Lookup
Simple Lookup interface for CharSequence
suggestions.
Nested Class Summary | |
---|---|
static class |
Lookup.LookupPriorityQueue
A PriorityQueue collecting a fixed size of high priority Lookup.LookupResult |
static class |
Lookup.LookupResult
Result of a lookup. |
Field Summary | |
---|---|
static Comparator<CharSequence> |
CHARSEQUENCE_COMPARATOR
A simple char-by-char comparator for CharSequence |
Constructor Summary | |
---|---|
Lookup()
|
Method Summary | |
---|---|
void |
build(Dictionary dict)
Build lookup from a dictionary. |
abstract void |
build(TermFreqIterator tfit)
Builds up a new internal Lookup representation based on the given TermFreqIterator . |
abstract boolean |
load(InputStream input)
Discard current lookup data and load it from a previously saved copy. |
abstract List<Lookup.LookupResult> |
lookup(CharSequence key,
boolean onlyMorePopular,
int num)
Look up a key and return possible completion for this key. |
abstract boolean |
store(OutputStream output)
Persist the constructed lookup data to a directory. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Comparator<CharSequence> CHARSEQUENCE_COMPARATOR
CharSequence
Constructor Detail |
---|
public Lookup()
Method Detail |
---|
public void build(Dictionary dict) throws IOException
SortedTermFreqIteratorWrapper
or
UnsortedTermFreqIteratorWrapper
in such case.
IOException
public abstract void build(TermFreqIterator tfit) throws IOException
Lookup
representation based on the given TermFreqIterator
.
The implementation might re-sort the data internally.
IOException
public abstract List<Lookup.LookupResult> lookup(CharSequence key, boolean onlyMorePopular, int num)
key
- lookup key. Depending on the implementation this may be
a prefix, misspelling, or even infix.onlyMorePopular
- return only more popular resultsnum
- maximum number of results to return
public abstract boolean store(OutputStream output) throws IOException
output
- OutputStream
to write the data to.
IOException
- when fatal IO error occurs.public abstract boolean load(InputStream input) throws IOException
input
- the InputStream
to load the lookup data.
IOException
- when fatal IO error occurs.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |