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
Nested ClassesModifier and TypeClassDescriptionstatic classSuggest.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.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.common.xcontent.ToXContent
EMPTY_PARAMS -
Constructor Summary
ConstructorsConstructorDescriptionSuggest(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 SuggestfromXContent(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)inthashCode()booleanWhether 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)intsize()The number of suggestions in thisSuggestresulttoString()org.elasticsearch.common.xcontent.XContentBuildertoXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)voidwriteTo(StreamOutput out)Write this into the StreamOutput.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods 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:
iteratorin interfaceIterable<Suggest.Suggestion<? extends Suggest.Suggestion.Entry<? extends Suggest.Suggestion.Entry.Option>>>
-
size
public int size()The number of suggestions in thisSuggestresult -
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:WriteableWrite this into the StreamOutput.- Specified by:
writeToin 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:
toXContentin 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
suggestionTypecontained in thisSuggestinstance
-
equals
-
hashCode
public int hashCode() -
toString
-