Class GroupSelector<T>
- java.lang.Object
-
- org.apache.lucene.search.grouping.GroupSelector<T>
-
- Type Parameters:
T- the type of the group value
- Direct Known Subclasses:
DoubleRangeGroupSelector,LongRangeGroupSelector,TermGroupSelector,ValueSourceGroupSelector
public abstract class GroupSelector<T> extends java.lang.ObjectDefines a group, for use by grouping collectors A GroupSelector acts as an iterator over documents. For each segment, clients should callsetNextReader(LeafReaderContext), and thenadvanceTo(int)for each matching document.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGroupSelector.StateWhat to do with the current value
-
Constructor Summary
Constructors Constructor Description GroupSelector()
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract GroupSelector.StateadvanceTo(int doc)Advance the GroupSelector's iterator to the given documentabstract TcopyValue()abstract TcurrentValue()Get the group value of the current document N.B.abstract voidsetGroups(java.util.Collection<SearchGroup<T>> groups)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, thenadvanceTo(int)will returnGroupSelector.State.SKIPabstract voidsetNextReader(LeafReaderContext readerContext)Set the LeafReaderContextabstract voidsetScorer(Scorable scorer)Set the current Scorer
-
-
-
Method Detail
-
setNextReader
public abstract void setNextReader(LeafReaderContext readerContext) throws java.io.IOException
Set the LeafReaderContext- Throws:
java.io.IOException
-
setScorer
public abstract void setScorer(Scorable scorer) throws java.io.IOException
Set the current Scorer- Throws:
java.io.IOException
-
advanceTo
public abstract GroupSelector.State advanceTo(int doc) throws java.io.IOException
Advance the GroupSelector's iterator to the given document- Throws:
java.io.IOException
-
currentValue
public abstract T currentValue() throws java.io.IOException
Get the group value of the current document N.B. this object may be reused, for a persistent version usecopyValue()- Throws:
java.io.IOException
-
copyValue
public abstract T copyValue() throws java.io.IOException
- Returns:
- a copy of the group value of the current document
- Throws:
java.io.IOException
-
setGroups
public abstract void setGroups(java.util.Collection<SearchGroup<T>> groups)
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, thenadvanceTo(int)will returnGroupSelector.State.SKIP- Parameters:
groups- a set ofSearchGroupobjects to limit selections to
-
-