Package org.elasticsearch.search.suggest
Class Suggest
java.lang.Object
org.elasticsearch.search.suggest.Suggest
- All Implemented Interfaces:
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 Object
implements 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
Modifier and TypeClassDescriptionstatic 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 inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
Constructor Summary
ConstructorDescriptionSuggest(List<Suggest.Suggestion<? extends Suggest.Suggestion.Entry<? extends Suggest.Suggestion.Entry.Option>>> suggestions)
Suggest(StreamInput in)
-
Method Summary
Modifier and TypeMethodDescriptionboolean
<T extends Suggest.Suggestion>
List<T>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(String name)
int
hashCode()
boolean
Whether any suggestions had query hitsIterator<Suggest.Suggestion<? extends Suggest.Suggestion.Entry<? extends Suggest.Suggestion.Entry.Option>>>
iterator()
static List<Suggest.Suggestion<? extends Suggest.Suggestion.Entry<? extends Suggest.Suggestion.Entry.Option>>>
reduce(Map<String,List<Suggest.Suggestion>> groupedSuggestions)
int
size()
The number of suggestions in thisSuggest
resulttoString()
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.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
Field Details
-
NAME
- See Also:
- Constant Field Values
-
COMPARATOR
-
-
Constructor Details
-
Suggest
public Suggest(List<Suggest.Suggestion<? extends Suggest.Suggestion.Entry<? extends Suggest.Suggestion.Entry.Option>>> suggestions) -
Suggest
- Throws:
IOException
-
-
Method Details
-
iterator
public Iterator<Suggest.Suggestion<? extends Suggest.Suggestion.Entry<? extends Suggest.Suggestion.Entry.Option>>> iterator()- Specified by:
iterator
in interfaceIterable<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(String name) -
hasScoreDocs
public boolean hasScoreDocs()Whether any suggestions had query hits -
writeTo
Description copied from interface:Writeable
Write this into the StreamOutput.- Specified by:
writeTo
in interfaceWriteable
- Throws:
IOException
-
toXContent
public org.elasticsearch.common.xcontent.XContentBuilder toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws IOException- Specified by:
toXContent
in interfaceorg.elasticsearch.common.xcontent.ToXContent
- Throws:
IOException
-
fromXContent
public static Suggest fromXContent(org.elasticsearch.common.xcontent.XContentParser parser) throws IOExceptionthis parsing method assumes that the leading "suggest" field name has already been parsed by the caller- Throws:
IOException
-
reduce
public static List<Suggest.Suggestion<? extends Suggest.Suggestion.Entry<? extends Suggest.Suggestion.Entry.Option>>> reduce(Map<String,List<Suggest.Suggestion>> groupedSuggestions) -
filter
- Returns:
- only suggestions of type
suggestionType
contained in thisSuggest
instance
-
equals
-
hashCode
public int hashCode() -
toString
-