Class AbstractAllGroupHeadsCollector<GH extends AbstractAllGroupHeadsCollector.GroupHead>

  • Direct Known Subclasses:
    TermAllGroupHeadsCollector

    public abstract class AbstractAllGroupHeadsCollector<GH extends AbstractAllGroupHeadsCollector.GroupHead>
    extends org.apache.lucene.search.Collector
    This collector specializes in collecting the most relevant document (group head) for each group that match the query.
    WARNING: This API is experimental and might change in incompatible ways in the next release.
    • Constructor Detail

      • AbstractAllGroupHeadsCollector

        protected AbstractAllGroupHeadsCollector​(int numberOfSorts)
    • Method Detail

      • retrieveGroupHeads

        public org.apache.lucene.util.FixedBitSet retrieveGroupHeads​(int maxDoc)
        Parameters:
        maxDoc - The maxDoc of the top level IndexReader.
        Returns:
        an 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.
      • retrieveGroupHeadAndAddIfNotExist

        protected abstract void retrieveGroupHeadAndAddIfNotExist​(int doc)
                                                           throws IOException
        Returns the group head and puts it into temporalResult. If the group head wasn't encountered before then it will be added to the collected group heads.

        The AbstractAllGroupHeadsCollector.TemporalResult.stop property will be true if the group head wasn't encountered before otherwise false.

        Parameters:
        doc - The document to retrieve the group head for.
        Throws:
        IOException - If I/O related errors occur
      • getCollectedGroupHeads

        protected abstract Collection<GH> 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 IOException
        Specified by:
        collect in class org.apache.lucene.search.Collector
        Throws:
        IOException
      • acceptsDocsOutOfOrder

        public boolean acceptsDocsOutOfOrder()
        Specified by:
        acceptsDocsOutOfOrder in class org.apache.lucene.search.Collector