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
Modifier | Constructor and Description |
---|---|
protected |
Suggestion() |
|
Suggestion(java.lang.String name,
int size) |
Modifier and Type | Method and Description |
---|---|
void |
addTerm(T entry) |
static Suggest.Suggestion<? extends Suggest.Suggestion.Entry<? extends Suggest.Suggestion.Entry.Option>> |
fromXContent(XContentParser parser) |
java.util.List<T> |
getEntries() |
java.lang.String |
getName() |
int |
getSize() |
protected java.lang.String |
getType()
Returns a string representing the type of the suggestion.
|
int |
getWriteableType()
Returns a integer representing the type of the suggestion.
|
protected void |
innerReadFrom(StreamInput in) |
void |
innerWriteTo(StreamOutput out) |
java.util.Iterator<T> |
iterator() |
protected T |
newEntry() |
protected static <E extends Suggest.Suggestion.Entry<?>> |
parseEntries(XContentParser parser,
Suggest.Suggestion<E> suggestion,
CheckedFunction<XContentParser,E,java.io.IOException> entryParser) |
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isFragment
public static final int TYPE
protected java.lang.String name
protected int size
protected final java.util.List<T extends Suggest.Suggestion.Entry> entries
protected Suggestion()
public Suggestion(java.lang.String name, int size)
public void addTerm(T entry)
public int getWriteableType()
protected java.lang.String 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 int getSize()
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
public static Suggest.Suggestion<? extends Suggest.Suggestion.Entry<? extends Suggest.Suggestion.Entry.Option>> fromXContent(XContentParser parser) throws java.io.IOException
java.io.IOException
protected static <E extends Suggest.Suggestion.Entry<?>> void parseEntries(XContentParser parser, Suggest.Suggestion<E> suggestion, CheckedFunction<XContentParser,E,java.io.IOException> entryParser) throws java.io.IOException
java.io.IOException