Module org.elasticsearch.server
Package org.elasticsearch.search.suggest
Class Suggest.Suggestion.Entry<O extends Suggest.Suggestion.Entry.Option>
java.lang.Object
org.elasticsearch.search.suggest.Suggest.Suggestion.Entry<O>
- All Implemented Interfaces:
Iterable<O>,Writeable,ToXContent,ToXContentFragment
- Direct Known Subclasses:
CompletionSuggestion.Entry,PhraseSuggestion.Entry,TermSuggestion.Entry
- Enclosing class:
Suggest.Suggestion<T extends Suggest.Suggestion.Entry>
public abstract static class Suggest.Suggestion.Entry<O extends Suggest.Suggestion.Entry.Option>
extends Object
implements Iterable<O>, Writeable, ToXContentFragment
Represents a part from the suggest text with suggested options.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classContains the suggested text with its document frequency and score.Nested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.ParamsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected intprotected static final Stringprotected TextFields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY, EMPTY_PARAMS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected voidaddOptions(List<O> options) booleanintintgetText()inthashCode()iterator()protected voidmerge(Suggest.Suggestion.Entry<O> other) Merge any extra fields for this subtype.protected abstract OnewOption(StreamInput in) protected <T extends Suggest.Suggestion.Entry<O>>
Suggest.Suggestion.Entry<O> protected voidsort(Comparator<O> comparator) toXContent(XContentBuilder builder, ToXContent.Params params) voidwriteTo(StreamOutput out) Write this into the StreamOutput.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface org.elasticsearch.xcontent.ToXContentFragment
isFragment
-
Field Details
-
OPTIONS
- See Also:
-
text
-
offset
protected int offset -
length
protected int length -
options
-
-
Constructor Details
-
Entry
-
Entry
protected Entry() -
Entry
- Throws:
IOException
-
-
Method Details
-
addOption
-
addOptions
-
sort
-
reduce
protected <T extends Suggest.Suggestion.Entry<O>> Suggest.Suggestion.Entry<O> reduce(List<T> toReduce) -
merge
Merge any extra fields for this subtype. -
getText
- Returns:
- the text (analyzed by suggest analyzer) originating from the suggest text. Usually this is a single term.
-
getOffset
public int getOffset()- Returns:
- the start offset (not analyzed) for this entry in the suggest text.
-
getLength
public int getLength()- Returns:
- the length (not analyzed) for this entry in the suggest text.
-
iterator
- Specified by:
iteratorin interfaceIterable<O extends Suggest.Suggestion.Entry.Option>
-
getOptions
- Returns:
- The suggested options for this particular suggest entry. If there are no suggested terms then an empty list is returned.
-
equals
-
hashCode
public int hashCode() -
newOption
- Throws:
IOException
-
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException - Specified by:
toXContentin interfaceToXContent- Throws:
IOException
-