Class FirstPassGroupingCollector<T>

java.lang.Object
org.apache.lucene.search.SimpleCollector
org.apache.lucene.search.grouping.FirstPassGroupingCollector<T>
All Implemented Interfaces:
Collector, LeafCollector

public class FirstPassGroupingCollector<T> extends SimpleCollector
FirstPassGroupingCollector is the first of two passes necessary to collect grouped hits. This pass gathers the top N sorted groups. Groups are defined by a GroupSelector

See org.apache.lucene.search.grouping for more details including a full code example.

  • Field Details

    • groupSelector

      private final GroupSelector<T> groupSelector
    • comparators

      private final FieldComparator<?>[] comparators
    • leafComparators

      private final LeafFieldComparator[] leafComparators
    • reversed

      private final int[] reversed
    • topNGroups

      private final int topNGroups
    • needsScores

      private final boolean needsScores
    • groupMap

      private final HashMap<T,CollectedSearchGroup<T>> groupMap
    • compIDXEnd

      private final int compIDXEnd
    • orderedGroups

      protected TreeSet<CollectedSearchGroup<T>> orderedGroups
    • docBase

      private int docBase
    • spareSlot

      private int spareSlot
  • Constructor Details

    • FirstPassGroupingCollector

      public FirstPassGroupingCollector(GroupSelector<T> groupSelector, Sort groupSort, int topNGroups)
      Create the first pass collector.
      Parameters:
      groupSelector - a GroupSelector used to defined groups
      groupSort - The Sort used to sort the groups. The top sorted document within each group according to groupSort, determines how that group sorts against other groups. This must be non-null, ie, if you want to groupSort by relevance use Sort.RELEVANCE.
      topNGroups - How many top groups to keep.
  • Method Details