Class CompletionSuggestion
- java.lang.Object
-
- org.elasticsearch.search.suggest.Suggest.Suggestion<CompletionSuggestion.Entry>
-
- org.elasticsearch.search.suggest.completion.CompletionSuggestion
-
- All Implemented Interfaces:
java.lang.Iterable<CompletionSuggestion.Entry>
,Streamable
,ToXContent
,ToXContentFragment
public final class CompletionSuggestion extends Suggest.Suggestion<CompletionSuggestion.Entry>
Suggestion response forCompletionSuggester
results Response format for each entry: { "text" : STRING "score" : FLOAT "contexts" : CONTEXTS } CONTEXTS : { "CONTEXT_NAME" : ARRAY, .. }
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CompletionSuggestion.Entry
-
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
NAME
static int
TYPE
-
Fields inherited from class org.elasticsearch.search.suggest.Suggest.Suggestion
entries, name, size
-
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
-
Constructor Summary
Constructors Constructor Description CompletionSuggestion()
CompletionSuggestion(java.lang.String name, int size, boolean skipDuplicates)
Ctr
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CompletionSuggestion
fromXContent(XContentParser parser, java.lang.String name)
java.util.List<CompletionSuggestion.Entry.Option>
getOptions()
protected java.lang.String
getType()
Returns a string representing the type of the suggestion.int
getWriteableType()
Returns a integer representing the type of the suggestion.boolean
hasScoreDocs()
protected CompletionSuggestion.Entry
newEntry()
void
readFrom(StreamInput in)
Set this object's fields from a StreamInput.Suggest.Suggestion<CompletionSuggestion.Entry>
reduce(java.util.List<Suggest.Suggestion<CompletionSuggestion.Entry>> toReduce)
Merges the result of another suggestion into this suggestion.static CompletionSuggestion
reduceTo(java.util.List<Suggest.Suggestion<CompletionSuggestion.Entry>> toReduce)
Reduces suggestions to a single suggestion containing at most topSuggest.Suggestion.getSize()
options acrosstoReduce
void
setShardIndex(int shardIndex)
void
writeTo(StreamOutput out)
Write this object's fields to a StreamOutput.-
Methods inherited from class org.elasticsearch.search.suggest.Suggest.Suggestion
addTerm, fromXContent, getEntries, getName, getSize, innerReadFrom, innerWriteTo, iterator, parseEntries, sortComparator, toXContent, trim
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
-
-
-
Field Detail
-
NAME
public static final java.lang.String NAME
- See Also:
- Constant Field Values
-
TYPE
public static final int TYPE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CompletionSuggestion
public CompletionSuggestion()
-
CompletionSuggestion
public CompletionSuggestion(java.lang.String name, int size, boolean skipDuplicates)
Ctr- Parameters:
name
- The name for the suggestionssize
- The number of suggestions to returnskipDuplicates
- Whether duplicate suggestions should be filtered out
-
-
Method Detail
-
readFrom
public void readFrom(StreamInput in) throws java.io.IOException
Description copied from interface:Streamable
Set this object's fields from a StreamInput.- Specified by:
readFrom
in interfaceStreamable
- Overrides:
readFrom
in classSuggest.Suggestion<CompletionSuggestion.Entry>
- Throws:
java.io.IOException
-
writeTo
public void writeTo(StreamOutput out) throws java.io.IOException
Description copied from interface:Streamable
Write this object's fields to a StreamOutput.- Specified by:
writeTo
in interfaceStreamable
- Overrides:
writeTo
in classSuggest.Suggestion<CompletionSuggestion.Entry>
- Throws:
java.io.IOException
-
getOptions
public java.util.List<CompletionSuggestion.Entry.Option> getOptions()
- Returns:
- the result options for the suggestion
-
hasScoreDocs
public boolean hasScoreDocs()
- Returns:
- whether there is any hits for the suggestion
-
fromXContent
public static CompletionSuggestion fromXContent(XContentParser parser, java.lang.String name) throws java.io.IOException
- Throws:
java.io.IOException
-
reduceTo
public static CompletionSuggestion reduceTo(java.util.List<Suggest.Suggestion<CompletionSuggestion.Entry>> toReduce)
Reduces suggestions to a single suggestion containing at most topSuggest.Suggestion.getSize()
options acrosstoReduce
-
reduce
public Suggest.Suggestion<CompletionSuggestion.Entry> reduce(java.util.List<Suggest.Suggestion<CompletionSuggestion.Entry>> toReduce)
Description copied from class:Suggest.Suggestion
Merges the result of another suggestion into this suggestion. For internal usage.- Overrides:
reduce
in classSuggest.Suggestion<CompletionSuggestion.Entry>
-
setShardIndex
public void setShardIndex(int shardIndex)
-
getWriteableType
public int getWriteableType()
Description copied from class:Suggest.Suggestion
Returns a integer representing the type of the suggestion. This is used for internal serialization over the network.- Overrides:
getWriteableType
in classSuggest.Suggestion<CompletionSuggestion.Entry>
-
getType
protected java.lang.String getType()
Description copied from class:Suggest.Suggestion
Returns a string representing the type of the suggestion. This type is added to the suggestion name in the XContent response, so that it can later be used by REST clients to determine the internal type of the suggestion.- Overrides:
getType
in classSuggest.Suggestion<CompletionSuggestion.Entry>
-
newEntry
protected CompletionSuggestion.Entry newEntry()
- Overrides:
newEntry
in classSuggest.Suggestion<CompletionSuggestion.Entry>
-
-