Module org.elasticsearch.server
Package org.elasticsearch.search.suggest
Class Suggest.Suggestion<T extends Suggest.Suggestion.Entry>
java.lang.Object
org.elasticsearch.search.suggest.Suggest.Suggestion<T>
- All Implemented Interfaces:
Iterable<T>,NamedWriteable,Writeable,ToXContent,ToXContentFragment
- Direct Known Subclasses:
CompletionSuggestion,PhraseSuggestion,TermSuggestion
- Enclosing class:
Suggest
public abstract static class Suggest.Suggestion<T extends Suggest.Suggestion.Entry>
extends Object
implements Iterable<T>, NamedWriteable, ToXContentFragment
The suggestion responses corresponding with the suggestions in the request.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents a part from the suggest text with suggested options.Nested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.ParamsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
FieldsFields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY, EMPTY_PARAMS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbooleangetName()intgetSize()abstract StringReturns the name of the writeable objectinthashCode()iterator()protected abstract TnewEntry(StreamInput in) reduce(List<Suggest.Suggestion<T>> toReduce) Merges the result of another suggestion into this suggestion.protected Comparator<Suggest.Suggestion.Entry.Option> toXContent(XContentBuilder builder, ToXContent.Params params) voidtrim()Trims the number of options per suggest text term to the requested size.voidwriteTo(StreamOutput out) Write this into the StreamOutput.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface org.elasticsearch.xcontent.ToXContentFragment
isFragment
-
Field Details
-
name
-
size
protected final int size -
entries
-
-
Constructor Details
-
Suggestion
-
Suggestion
- Throws:
IOException
-
-
Method Details
-
addTerm
-
iterator
- Specified by:
iteratorin interfaceIterable<T extends Suggest.Suggestion.Entry>
-
getEntries
- Returns:
- The entries for this suggestion.
-
getName
- Returns:
- The name of the suggestion as is defined in the request.
-
getSize
public int getSize()- Returns:
- The number of requested suggestion option size
-
reduce
Merges the result of another suggestion into this suggestion. For internal usage. -
sortComparator
-
trim
public void trim()Trims the number of options per suggest text term to the requested size. For internal usage. -
newEntry
- Throws:
IOException
-
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
getWriteableName
Description copied from interface:NamedWriteableReturns the name of the writeable object- Specified by:
getWriteableNamein interfaceNamedWriteable
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException - Specified by:
toXContentin interfaceToXContent- Throws:
IOException
-
equals
-
hashCode
public int hashCode()
-