public abstract class Lookup extends java.lang.Object implements Accountable
CharSequence
suggestions.Modifier and Type | Class and Description |
---|---|
static class |
Lookup.LookupPriorityQueue
A
PriorityQueue collecting a fixed size of high priority Lookup.LookupResult |
static class |
Lookup.LookupResult
Result of a lookup.
|
Modifier and Type | Field and Description |
---|---|
static java.util.Comparator<java.lang.CharSequence> |
CHARSEQUENCE_COMPARATOR
A simple char-by-char comparator for
CharSequence |
Constructor and Description |
---|
Lookup()
Sole constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
build(Dictionary dict)
Build lookup from a dictionary.
|
abstract void |
build(InputIterator inputIterator)
Builds up a new internal
Lookup representation based on the given InputIterator . |
abstract long |
getCount()
Get the number of entries the lookup was built with
|
abstract boolean |
load(DataInput input)
Discard current lookup data and load it from a previously saved copy.
|
boolean |
load(java.io.InputStream input)
|
java.util.List<Lookup.LookupResult> |
lookup(java.lang.CharSequence key,
boolean onlyMorePopular,
int num)
Look up a key and return possible completion for this key.
|
java.util.List<Lookup.LookupResult> |
lookup(java.lang.CharSequence key,
BooleanQuery contextFilerQuery,
int num,
boolean allTermsRequired,
boolean doHighlight)
Look up a key and return possible completion for this key.
|
abstract java.util.List<Lookup.LookupResult> |
lookup(java.lang.CharSequence key,
java.util.Set<BytesRef> contexts,
boolean onlyMorePopular,
int num)
Look up a key and return possible completion for this key.
|
abstract boolean |
store(DataOutput output)
Persist the constructed lookup data to a directory.
|
boolean |
store(java.io.OutputStream output)
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getChildResources, ramBytesUsed
public static final java.util.Comparator<java.lang.CharSequence> CHARSEQUENCE_COMPARATOR
CharSequence
public Lookup()
public void build(Dictionary dict) throws java.io.IOException
SortedInputIterator
or
UnsortedInputIterator
in such case.java.io.IOException
public boolean load(java.io.InputStream input) throws java.io.IOException
java.io.IOException
public boolean store(java.io.OutputStream output) throws java.io.IOException
java.io.IOException
public abstract long getCount() throws java.io.IOException
java.io.IOException
public abstract void build(InputIterator inputIterator) throws java.io.IOException
Lookup
representation based on the given InputIterator
.
The implementation might re-sort the data internally.java.io.IOException
public java.util.List<Lookup.LookupResult> lookup(java.lang.CharSequence key, boolean onlyMorePopular, int num) throws java.io.IOException
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 returnjava.io.IOException
public abstract java.util.List<Lookup.LookupResult> lookup(java.lang.CharSequence key, java.util.Set<BytesRef> contexts, boolean onlyMorePopular, int num) throws java.io.IOException
key
- lookup key. Depending on the implementation this may be
a prefix, misspelling, or even infix.contexts
- contexts to filter the lookup by, or null if all contexts are allowed; if the suggestion contains any of the contexts, it's a matchonlyMorePopular
- return only more popular resultsnum
- maximum number of results to returnjava.io.IOException
public java.util.List<Lookup.LookupResult> lookup(java.lang.CharSequence key, BooleanQuery contextFilerQuery, int num, boolean allTermsRequired, boolean doHighlight) throws java.io.IOException
key
- the lookup keycontextFilerQuery
- A query for further filtering the result of the key lookupnum
- maximum number of results to returnallTermsRequired
- true is all terms are requireddoHighlight
- set to true if key should be highlightedjava.io.IOException
- when IO exception occurspublic abstract boolean store(DataOutput output) throws java.io.IOException
output
- DataOutput
to write the data to.java.io.IOException
- when fatal IO error occurs.public abstract boolean load(DataInput input) throws java.io.IOException
input
- the DataInput
to load the lookup data.java.io.IOException
- when fatal IO error occurs.Copyright © 2000–2019 The Apache Software Foundation. All rights reserved.