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
,org.elasticsearch.xcontent.ToXContent
,org.elasticsearch.xcontent.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, org.elasticsearch.xcontent.ToXContentFragment
The suggestion responses corresponding with the suggestions in the request.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Represents a part from the suggest text with suggested options.Nested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
org.elasticsearch.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.xcontent.ToXContent.MapParams, org.elasticsearch.xcontent.ToXContent.Params
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
Field Summary
Fields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY_PARAMS
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
boolean
static Suggest.Suggestion<? extends Suggest.Suggestion.Entry<? extends Suggest.Suggestion.Entry.Option>>
fromXContent
(org.elasticsearch.xcontent.XContentParser parser) getName()
int
getSize()
abstract String
Returns the name of the writeable objectint
hashCode()
iterator()
protected abstract T
newEntry
(StreamInput in) protected static <E extends Suggest.Suggestion.Entry<?>>
voidparseEntries
(org.elasticsearch.xcontent.XContentParser parser, Suggest.Suggestion<E> suggestion, org.elasticsearch.core.CheckedFunction<org.elasticsearch.xcontent.XContentParser, E, IOException> entryParser) reduce
(List<Suggest.Suggestion<T>> toReduce) Merges the result of another suggestion into this suggestion.protected Comparator<Suggest.Suggestion.Entry.Option>
org.elasticsearch.xcontent.XContentBuilder
toXContent
(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) void
trim()
Trims the number of options per suggest text term to the requested size.void
writeTo
(StreamOutput out) Write this into the StreamOutput.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface org.elasticsearch.xcontent.ToXContentFragment
isFragment
-
Field Details
-
TYPE
public static final int TYPE- See Also:
-
name
-
size
protected final int size -
entries
-
-
Constructor Details
-
Suggestion
-
Suggestion
- Throws:
IOException
-
-
Method Details
-
addTerm
-
iterator
- Specified by:
iterator
in 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:Writeable
Write this into the StreamOutput.- Specified by:
writeTo
in interfaceWriteable
- Throws:
IOException
-
getWriteableName
Description copied from interface:NamedWriteable
Returns the name of the writeable object- Specified by:
getWriteableName
in interfaceNamedWriteable
-
toXContent
public org.elasticsearch.xcontent.XContentBuilder toXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) throws IOException - Specified by:
toXContent
in interfaceorg.elasticsearch.xcontent.ToXContent
- Throws:
IOException
-
equals
-
hashCode
public int hashCode() -
fromXContent
public static Suggest.Suggestion<? extends Suggest.Suggestion.Entry<? extends Suggest.Suggestion.Entry.Option>> fromXContent(org.elasticsearch.xcontent.XContentParser parser) throws IOException - Throws:
IOException
-
parseEntries
protected static <E extends Suggest.Suggestion.Entry<?>> void parseEntries(org.elasticsearch.xcontent.XContentParser parser, Suggest.Suggestion<E> suggestion, org.elasticsearch.core.CheckedFunction<org.elasticsearch.xcontent.XContentParser, E, throws IOExceptionIOException> entryParser) - Throws:
IOException
-