public static class Suggest.Suggestion<T extends Suggest.Suggestion.Entry> extends java.lang.Object implements java.lang.Iterable<T>, Streamable, ToXContent
Modifier and Type | Class and Description |
---|---|
static class |
Suggest.Suggestion.Entry<O extends Suggest.Suggestion.Entry.Option>
Represents a part from the suggest text with suggested options.
|
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
Modifier and Type | Field and Description |
---|---|
protected java.util.List<T> |
entries |
protected java.lang.String |
name |
protected int |
size |
static int |
TYPE |
EMPTY_PARAMS
Constructor and Description |
---|
Suggestion() |
Suggestion(java.lang.String name,
int size) |
Modifier and Type | Method and Description |
---|---|
void |
addTerm(T entry) |
java.util.List<T> |
getEntries() |
java.lang.String |
getName() |
int |
getType() |
protected void |
innerReadFrom(StreamInput in) |
void |
innerWriteTo(StreamOutput out) |
java.util.Iterator<T> |
iterator() |
protected T |
newEntry() |
void |
readFrom(StreamInput in)
Set this object's fields from a StreamInput.
|
Suggest.Suggestion<T> |
reduce(java.util.List<Suggest.Suggestion<T>> toReduce)
Merges the result of another suggestion into this suggestion.
|
protected java.util.Comparator<Suggest.Suggestion.Entry.Option> |
sortComparator() |
XContentBuilder |
toXContent(XContentBuilder builder,
ToXContent.Params params) |
void |
trim()
Trims the number of options per suggest text term to the requested size.
|
void |
writeTo(StreamOutput out)
Write this object's fields to a StreamOutput.
|
public static final int TYPE
protected java.lang.String name
protected int size
protected final java.util.List<T extends Suggest.Suggestion.Entry> entries
public Suggestion()
public Suggestion(java.lang.String name, int size)
public void addTerm(T entry)
public int getType()
public java.util.Iterator<T> iterator()
iterator
in interface java.lang.Iterable<T extends Suggest.Suggestion.Entry>
public java.util.List<T> getEntries()
public java.lang.String getName()
public Suggest.Suggestion<T> reduce(java.util.List<Suggest.Suggestion<T>> toReduce)
protected java.util.Comparator<Suggest.Suggestion.Entry.Option> sortComparator()
public void trim()
public void readFrom(StreamInput in) throws java.io.IOException
Streamable
readFrom
in interface Streamable
java.io.IOException
protected T newEntry()
protected void innerReadFrom(StreamInput in) throws java.io.IOException
java.io.IOException
public void writeTo(StreamOutput out) throws java.io.IOException
Streamable
writeTo
in interface Streamable
java.io.IOException
public void innerWriteTo(StreamOutput out) throws java.io.IOException
java.io.IOException
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
toXContent
in interface ToXContent
java.io.IOException