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:
java.lang.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 java.lang.Object implements java.lang.Iterable<O>, Writeable, ToXContentFragment
Represents a part from the suggest text with suggested options.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Suggest.Suggestion.Entry.Option
Contains the suggested text with its document frequency and score.Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
Field Summary
-
Constructor Summary
Constructors Modifier Constructor Description protected
Entry()
Entry(StreamInput in)
Entry(Text text, int offset, int length)
-
Method Summary
Modifier and Type Method Description void
addOption(O option)
protected void
addOptions(java.util.List<O> options)
protected static void
declareCommonFields(ObjectParser<? extends Suggest.Suggestion.Entry<? extends Suggest.Suggestion.Entry.Option>,java.lang.Void> parser)
boolean
equals(java.lang.Object o)
int
getLength()
int
getOffset()
java.util.List<O>
getOptions()
Text
getText()
int
hashCode()
java.util.Iterator<O>
iterator()
protected void
merge(Suggest.Suggestion.Entry<O> other)
Merge any extra fields for this subtype.protected abstract O
newOption(StreamInput in)
protected <T extends Suggest.Suggestion.Entry<O>>
Suggest.Suggestion.Entry<O>reduce(java.util.List<T> toReduce)
protected void
sort(java.util.Comparator<O> comparator)
XContentBuilder
toXContent(XContentBuilder builder, ToXContent.Params params)
void
writeTo(StreamOutput out)
Write this into the StreamOutput.
-
Field Details
-
Constructor Details
-
Method Details
-
addOption
-
addOptions
-
sort
-
reduce
protected <T extends Suggest.Suggestion.Entry<O>> Suggest.Suggestion.Entry<O> reduce(java.util.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:
iterator
in interfacejava.lang.Iterable<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
public boolean equals(java.lang.Object o)- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCode
in classjava.lang.Object
-
newOption
- Throws:
java.io.IOException
-
writeTo
Description copied from interface:Writeable
Write this into the StreamOutput. -
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException- Specified by:
toXContent
in interfaceToXContent
- Throws:
java.io.IOException
-
declareCommonFields
protected static void declareCommonFields(ObjectParser<? extends Suggest.Suggestion.Entry<? extends Suggest.Suggestion.Entry.Option>,java.lang.Void> parser)
-