Package org.elasticsearch.search.suggest
Class Suggest
java.lang.Object
org.elasticsearch.search.suggest.Suggest
- All Implemented Interfaces:
java.lang.Iterable<Suggest.Suggestion<? extends Suggest.Suggestion.Entry<? extends Suggest.Suggestion.Entry.Option>>>
,Writeable
,org.elasticsearch.common.xcontent.ToXContent
,org.elasticsearch.common.xcontent.ToXContentFragment
public class Suggest extends java.lang.Object implements java.lang.Iterable<Suggest.Suggestion<? extends Suggest.Suggestion.Entry<? extends Suggest.Suggestion.Entry.Option>>>, Writeable, org.elasticsearch.common.xcontent.ToXContentFragment
Top level suggest result, containing the result for each suggestion.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Suggest.Suggestion<T extends Suggest.Suggestion.Entry>
The suggestion responses corresponding with the suggestions in the request.Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
org.elasticsearch.common.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.common.xcontent.ToXContent.MapParams, org.elasticsearch.common.xcontent.ToXContent.Params
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
Field Summary
Fields Modifier and Type Field Description static java.util.Comparator<Suggest.Suggestion.Entry.Option>
COMPARATOR
static java.lang.String
NAME
-
Constructor Summary
Constructors Constructor Description Suggest(java.util.List<Suggest.Suggestion<? extends Suggest.Suggestion.Entry<? extends Suggest.Suggestion.Entry.Option>>> suggestions)
Suggest(StreamInput in)
-
Method Summary
Modifier and Type Method Description boolean
equals(java.lang.Object other)
<T extends Suggest.Suggestion>
java.util.List<T>filter(java.lang.Class<T> suggestionType)
static Suggest
fromXContent(org.elasticsearch.common.xcontent.XContentParser parser)
this parsing method assumes that the leading "suggest" field name has already been parsed by the caller<T extends Suggest.Suggestion<? extends Suggest.Suggestion.Entry<? extends Suggest.Suggestion.Entry.Option>>>
TgetSuggestion(java.lang.String name)
int
hashCode()
boolean
hasScoreDocs()
Whether any suggestions had query hitsjava.util.Iterator<Suggest.Suggestion<? extends Suggest.Suggestion.Entry<? extends Suggest.Suggestion.Entry.Option>>>
iterator()
static java.util.List<Suggest.Suggestion<? extends Suggest.Suggestion.Entry<? extends Suggest.Suggestion.Entry.Option>>>
reduce(java.util.Map<java.lang.String,java.util.List<Suggest.Suggestion>> groupedSuggestions)
int
size()
The number of suggestions in thisSuggest
resultjava.lang.String
toString()
org.elasticsearch.common.xcontent.XContentBuilder
toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)
void
writeTo(StreamOutput out)
Write this into the StreamOutput.
-
Field Details
-
NAME
public static final java.lang.String NAME- See Also:
- Constant Field Values
-
COMPARATOR
-
-
Constructor Details
-
Suggest
public Suggest(java.util.List<Suggest.Suggestion<? extends Suggest.Suggestion.Entry<? extends Suggest.Suggestion.Entry.Option>>> suggestions) -
Suggest
- Throws:
java.io.IOException
-
-
Method Details
-
iterator
public java.util.Iterator<Suggest.Suggestion<? extends Suggest.Suggestion.Entry<? extends Suggest.Suggestion.Entry.Option>>> iterator()- Specified by:
iterator
in interfacejava.lang.Iterable<Suggest.Suggestion<? extends Suggest.Suggestion.Entry<? extends Suggest.Suggestion.Entry.Option>>>
-
size
public int size()The number of suggestions in thisSuggest
result -
getSuggestion
public <T extends Suggest.Suggestion<? extends Suggest.Suggestion.Entry<? extends Suggest.Suggestion.Entry.Option>>> T getSuggestion(java.lang.String name) -
hasScoreDocs
public boolean hasScoreDocs()Whether any suggestions had query hits -
writeTo
Description copied from interface:Writeable
Write this into the StreamOutput. -
toXContent
public org.elasticsearch.common.xcontent.XContentBuilder toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws java.io.IOException- Specified by:
toXContent
in interfaceorg.elasticsearch.common.xcontent.ToXContent
- Throws:
java.io.IOException
-
fromXContent
public static Suggest fromXContent(org.elasticsearch.common.xcontent.XContentParser parser) throws java.io.IOExceptionthis parsing method assumes that the leading "suggest" field name has already been parsed by the caller- Throws:
java.io.IOException
-
reduce
public static java.util.List<Suggest.Suggestion<? extends Suggest.Suggestion.Entry<? extends Suggest.Suggestion.Entry.Option>>> reduce(java.util.Map<java.lang.String,java.util.List<Suggest.Suggestion>> groupedSuggestions) -
filter
- Returns:
- only suggestions of type
suggestionType
contained in thisSuggest
instance
-
equals
public boolean equals(java.lang.Object other)- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-