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 Classes Modifier and Type Class Description static classSuggest.Suggestion.Entry.OptionContains 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>
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedEntry()Entry(StreamInput in)Entry(Text text, int offset, int length)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddOption(O option)protected voidaddOptions(List<O> options)protected static voiddeclareCommonFields(ObjectParser<? extends Suggest.Suggestion.Entry<? extends Suggest.Suggestion.Entry.Option>,Void> parser)booleanequals(Object o)intgetLength()intgetOffset()List<O>getOptions()TextgetText()inthashCode()Iterator<O>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>reduce(List<T> toReduce)protected voidsort(Comparator<O> comparator)XContentBuildertoXContent(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, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
-
-
-
Field Detail
-
OPTIONS
protected static final String OPTIONS
- See Also:
- Constant Field Values
-
text
protected Text text
-
offset
protected int offset
-
length
protected int length
-
options
protected List<O extends Suggest.Suggestion.Entry.Option> options
-
-
Constructor Detail
-
Entry
public Entry(Text text, int offset, int length)
-
Entry
protected Entry()
-
Entry
public Entry(StreamInput in) throws IOException
- Throws:
IOException
-
-
Method Detail
-
addOption
public void addOption(O option)
-
sort
protected void sort(Comparator<O> comparator)
-
reduce
protected <T extends Suggest.Suggestion.Entry<O>> Suggest.Suggestion.Entry<O> reduce(List<T> toReduce)
-
merge
protected void merge(Suggest.Suggestion.Entry<O> other)
Merge any extra fields for this subtype.
-
getText
public Text 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
public Iterator<O> iterator()
- Specified by:
iteratorin interfaceIterable<O extends Suggest.Suggestion.Entry.Option>
-
getOptions
public List<O> getOptions()
- Returns:
- The suggested options for this particular suggest entry. If there are no suggested terms then an empty list is returned.
-
newOption
protected abstract O newOption(StreamInput in) throws IOException
- Throws:
IOException
-
writeTo
public void writeTo(StreamOutput out) throws IOException
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
-
declareCommonFields
protected static void declareCommonFields(ObjectParser<? extends Suggest.Suggestion.Entry<? extends Suggest.Suggestion.Entry.Option>,Void> parser)
-
-