Class TermGroupSelector
- java.lang.Object
-
- org.apache.lucene.search.grouping.GroupSelector<BytesRef>
-
- org.apache.lucene.search.grouping.TermGroupSelector
-
public class TermGroupSelector extends GroupSelector<BytesRef>
A GroupSelector implementation that groups via SortedDocValues
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.lucene.search.grouping.GroupSelector
GroupSelector.State
-
-
Field Summary
Fields Modifier and Type Field Description private SortedDocValuesdocValuesprivate java.lang.Stringfieldprivate intgroupIdprivate booleanincludeEmptyprivate java.util.Map<java.lang.Integer,java.lang.Integer>ordsToGroupIdsprivate BytesRefscratchprivate booleansecondPassprivate BytesRefHashvalues
-
Constructor Summary
Constructors Constructor Description TermGroupSelector(java.lang.String field)Create a new TermGroupSelector
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GroupSelector.StateadvanceTo(int doc)Advance the GroupSelector's iterator to the given documentBytesRefcopyValue()BytesRefcurrentValue()Get the group value of the current document N.B.voidsetGroups(java.util.Collection<SearchGroup<BytesRef>> searchGroups)Set a restriction on the group values returned by this selector If the selector is positioned on a document whose group value is not contained within this set, thenGroupSelector.advanceTo(int)will returnGroupSelector.State.SKIPvoidsetNextReader(LeafReaderContext readerContext)Set the LeafReaderContextvoidsetScorer(Scorable scorer)Set the current Scorer
-
-
-
Field Detail
-
field
private final java.lang.String field
-
values
private final BytesRefHash values
-
ordsToGroupIds
private final java.util.Map<java.lang.Integer,java.lang.Integer> ordsToGroupIds
-
docValues
private SortedDocValues docValues
-
groupId
private int groupId
-
secondPass
private boolean secondPass
-
includeEmpty
private boolean includeEmpty
-
scratch
private BytesRef scratch
-
-
Method Detail
-
setNextReader
public void setNextReader(LeafReaderContext readerContext) throws java.io.IOException
Description copied from class:GroupSelectorSet the LeafReaderContext- Specified by:
setNextReaderin classGroupSelector<BytesRef>- Throws:
java.io.IOException
-
setScorer
public void setScorer(Scorable scorer) throws java.io.IOException
Description copied from class:GroupSelectorSet the current Scorer- Specified by:
setScorerin classGroupSelector<BytesRef>- Throws:
java.io.IOException
-
advanceTo
public GroupSelector.State advanceTo(int doc) throws java.io.IOException
Description copied from class:GroupSelectorAdvance the GroupSelector's iterator to the given document- Specified by:
advanceToin classGroupSelector<BytesRef>- Throws:
java.io.IOException
-
currentValue
public BytesRef currentValue()
Description copied from class:GroupSelectorGet the group value of the current document N.B. this object may be reused, for a persistent version useGroupSelector.copyValue()- Specified by:
currentValuein classGroupSelector<BytesRef>
-
copyValue
public BytesRef copyValue()
- Specified by:
copyValuein classGroupSelector<BytesRef>- Returns:
- a copy of the group value of the current document
-
setGroups
public void setGroups(java.util.Collection<SearchGroup<BytesRef>> searchGroups)
Description copied from class:GroupSelectorSet a restriction on the group values returned by this selector If the selector is positioned on a document whose group value is not contained within this set, thenGroupSelector.advanceTo(int)will returnGroupSelector.State.SKIP- Specified by:
setGroupsin classGroupSelector<BytesRef>- Parameters:
searchGroups- a set ofSearchGroupobjects to limit selections to
-
-