Class CompletionSuggestion
org.elasticsearch.search.suggest.Suggest.Suggestion<CompletionSuggestion.Entry>
org.elasticsearch.search.suggest.completion.CompletionSuggestion
- All Implemented Interfaces:
<CompletionSuggestion.Entry>
,NamedWriteable
,Writeable
,org.elasticsearch.common.xcontent.ToXContent
,org.elasticsearch.common.xcontent.ToXContentFragment
Suggestion response for
CompletionSuggester
results
Response format for each entry:
{
"text" : STRING
"score" : FLOAT
"contexts" : CONTEXTS
}
CONTEXTS : {
"CONTEXT_NAME" : ARRAY,
..
}-
Nested Class Summary
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 class org.elasticsearch.search.suggest.Suggest.Suggestion
entries, name, size
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
Constructor Summary
ConstructorDescriptionname, int size, boolean skipDuplicates)
Creates a completion suggestion given its name, size and whether it should skip duplicates -
Method Summary
Modifier and TypeMethodDescriptionboolean
other)
static CompletionSuggestion
fromXContent(org.elasticsearch.common.xcontent.XContentParser parser, name)
Returns the name of the writeable objectint
Returns a integer representing the type of the suggestion.int
hashCode()
boolean
protected CompletionSuggestion.Entry
newEntry(StreamInput in)
<Suggest.Suggestion<CompletionSuggestion.Entry>> toReduce)
Merges the result of another suggestion into this suggestion.void
setShardIndex(int shardIndex)
void
writeTo(StreamOutput out)
Write this into the StreamOutput.Methods inherited from class org.elasticsearch.search.suggest.Suggest.Suggestion
addTerm, fromXContent, getEntries, getName, getSize, iterator, parseEntries, sortComparator, toXContent, trim
Methods inherited from class java.lang.
, , , , , , , ,
Methods inherited from interface java.lang.
,
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
Field Details
-
TYPE
public static final int TYPEDeprecated.- See Also:
- Constant Field Values
-
-
Constructor Details
-
CompletionSuggestion
public CompletionSuggestion( name, int size, boolean skipDuplicates)Creates a completion suggestion given its name, size and whether it should skip duplicates- Parameters:
name
- The name for the suggestionssize
- The number of suggestions to returnskipDuplicates
- Whether duplicate suggestions should be filtered out
-
CompletionSuggestion
- Throws:
-
-
Method Details
-
getWriteableName
public getWriteableName()Description copied from interface:NamedWriteable
Returns the name of the writeable object- Specified by:
getWriteableName
in interfaceNamedWriteable
- Specified by:
getWriteableName
in classSuggest.Suggestion<CompletionSuggestion.Entry>
-
writeTo
Description copied from interface:Writeable
Write this into the StreamOutput.- Specified by:
writeTo
in interfaceWriteable
- Overrides:
writeTo
in classSuggest.Suggestion<CompletionSuggestion.Entry>
- Throws:
-
getOptions
- Returns:
- the result options for the suggestion
-
hasScoreDocs
public boolean hasScoreDocs()- Returns:
- whether there is any hits for the suggestion
-
equals
public boolean equals( other)- Overrides:
equals
in classSuggest.Suggestion<CompletionSuggestion.Entry>
-
hashCode
public int hashCode()- Overrides:
hashCode
in classSuggest.Suggestion<CompletionSuggestion.Entry>
-
fromXContent
public static CompletionSuggestion fromXContent(org.elasticsearch.common.xcontent.XContentParser parser, name) throws- Throws:
-
reduce
public <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. This class is now serialized as a NamedWriteable and this method only remains for backwards compatibility- Overrides:
getWriteableType
in classSuggest.Suggestion<CompletionSuggestion.Entry>
-
newEntry
- Specified by:
newEntry
in classSuggest.Suggestion<CompletionSuggestion.Entry>
- Throws:
-