Class GroupReducer<T,​C extends Collector>

  • Type Parameters:
    T - the type of the value used for grouping
    C - the type of Collector used to reduce each group

    public abstract class GroupReducer<T,​C extends Collector>
    extends Object
    Concrete implementations of this class define what to collect for individual groups during the second-pass of a grouping search.

    Each group is assigned a Collector returned by newCollector(), and LeafCollector.collect(int) is called for each document that is in a group

    See Also:
    SecondPassGroupingCollector
    • Constructor Detail

      • GroupReducer

        public GroupReducer()
    • Method Detail

      • needsScores

        public abstract boolean needsScores()
        Whether or not this reducer requires collected documents to be scored
      • newCollector

        protected abstract C newCollector()
        Creates a new Collector for each group
      • getCollector

        public final C getCollector​(T value)
        Get the Collector for a given group
      • collect

        public final void collect​(T value,
                                  int doc)
                           throws IOException
        Collect a given document into a given group
        Throws:
        IOException - on error