Class AllGroupHeadsCollector<T>

    • Constructor Detail

      • AllGroupHeadsCollector

        private AllGroupHeadsCollector​(GroupSelector<T> selector,
                                       Sort sort)
    • Method Detail

      • newCollector

        public static <T> AllGroupHeadsCollector<T> newCollector​(GroupSelector<T> selector,
                                                                 Sort sort)
        Create a new AllGroupHeadsCollector based on the type of within-group Sort required
        Type Parameters:
        T - the group value type
        Parameters:
        selector - a GroupSelector to define the groups
        sort - the within-group sort to use to choose the group head document
      • retrieveGroupHeads

        public FixedBitSet retrieveGroupHeads​(int maxDoc)
        Parameters:
        maxDoc - The maxDoc of the top level IndexReader.
        Returns:
        a FixedBitSet containing all group heads.
      • retrieveGroupHeads

        public int[] retrieveGroupHeads()
        Returns:
        an int array containing all group heads. The size of the array is equal to number of collected unique groups.
      • groupHeadsSize

        public int groupHeadsSize()
        Returns:
        the number of group heads found for a query.
      • getCollectedGroupHeads

        protected java.util.Collection<? extends AllGroupHeadsCollector.GroupHead<T>> getCollectedGroupHeads()
        Returns the collected group heads. Subsequent calls should return the same group heads.
        Returns:
        the collected group heads
      • collect

        public void collect​(int doc)
                     throws java.io.IOException
        Description copied from interface: LeafCollector
        Called once for every document matching a query, with the unbased document number.

        Note: The collection of the current segment can be terminated by throwing a CollectionTerminatedException. In this case, the last docs of the current LeafReaderContext will be skipped and IndexSearcher will swallow the exception and continue collection with the next leaf.

        Note: This is called in an inner search loop. For good search performance, implementations of this method should not call IndexSearcher.doc(int) or IndexReader.document(int) on every hit. Doing so can slow searches by an order of magnitude or more.

        Specified by:
        collect in interface LeafCollector
        Specified by:
        collect in class SimpleCollector
        Throws:
        java.io.IOException
      • scoreMode

        public ScoreMode scoreMode()
        Description copied from interface: Collector
        Indicates what features are required from the scorer.
      • newGroupHead

        protected abstract AllGroupHeadsCollector.GroupHead<T> newGroupHead​(int doc,
                                                                            T value,
                                                                            LeafReaderContext context,
                                                                            Scorable scorer)
                                                                     throws java.io.IOException
        Create a new GroupHead for the given group value, initialized with a doc, context and scorer
        Throws:
        java.io.IOException