Class BestDocsDeferringCollector

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, org.apache.lucene.search.Collector, Releasable

    public class BestDocsDeferringCollector
    extends DeferringBucketCollector
    implements Releasable
    A specialization of DeferringBucketCollector that collects all matches and then replays only the top scoring documents to child aggregations. The method createTopDocsCollector(int) is designed to be overridden and allows subclasses to choose a custom collector implementation for determining the top N matches.
    • Method Detail

      • needsScores

        public boolean needsScores()
        Specified by:
        needsScores in interface org.apache.lucene.search.Collector
      • getLeafCollector

        public LeafBucketCollector getLeafCollector​(org.apache.lucene.index.LeafReaderContext ctx)
                                             throws java.io.IOException
        Specified by:
        getLeafCollector in interface org.apache.lucene.search.Collector
        Specified by:
        getLeafCollector in class BucketCollector
        Throws:
        java.io.IOException
      • createTopDocsCollector

        protected org.apache.lucene.search.TopDocsCollector<? extends org.apache.lucene.search.ScoreDoc> createTopDocsCollector​(int size)
                                                                                                                         throws java.io.IOException
        Throws:
        java.io.IOException
      • preCollection

        public void preCollection()
                           throws java.io.IOException
        Description copied from class: BucketCollector
        Pre collection callback.
        Specified by:
        preCollection in class BucketCollector
        Throws:
        java.io.IOException
      • postCollection

        public void postCollection()
                            throws java.io.IOException
        Description copied from class: BucketCollector
        Post-collection callback.
        Specified by:
        postCollection in class BucketCollector
        Throws:
        java.io.IOException
      • getDocCount

        public int getDocCount​(long parentBucket)