Class DelegatingCollector

  • All Implemented Interfaces:
    org.apache.lucene.search.Collector, org.apache.lucene.search.LeafCollector

    public class DelegatingCollector
    extends org.apache.lucene.search.SimpleCollector
    A simple delegating collector where one can set the delegate after creation
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.apache.lucene.index.LeafReaderContext context  
      protected org.apache.lucene.search.Collector delegate  
      protected int docBase  
      protected org.apache.lucene.search.LeafCollector leafDelegate  
      protected org.apache.lucene.search.Scorable scorer  
      static int setLastDelegateCount  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void collect​(int doc)  
      void complete()
      since 9.4
      protected void doSetNextReader​(org.apache.lucene.index.LeafReaderContext context)  
      void finish()
      From Solr 9.4 using Lucene 9.8 onwards DelegatingCollector.finish clashes with the super class's LeafCollector.finish method.
      org.apache.lucene.search.Collector getDelegate()  
      org.apache.lucene.search.ScoreMode scoreMode()  
      void setDelegate​(org.apache.lucene.search.Collector delegate)  
      void setLastDelegate​(org.apache.lucene.search.Collector delegate)
      Sets the last delegate in a chain of DelegatingCollectors
      void setScorer​(org.apache.lucene.search.Scorable scorer)  
      • Methods inherited from class org.apache.lucene.search.SimpleCollector

        getLeafCollector
      • Methods inherited from interface org.apache.lucene.search.Collector

        setWeight
      • Methods inherited from interface org.apache.lucene.search.LeafCollector

        collect, competitiveIterator
    • Field Detail

      • setLastDelegateCount

        public static int setLastDelegateCount
      • delegate

        protected org.apache.lucene.search.Collector delegate
      • leafDelegate

        protected org.apache.lucene.search.LeafCollector leafDelegate
      • scorer

        protected org.apache.lucene.search.Scorable scorer
      • context

        protected org.apache.lucene.index.LeafReaderContext context
      • docBase

        protected int docBase
    • Constructor Detail

      • DelegatingCollector

        public DelegatingCollector()
    • Method Detail

      • getDelegate

        public org.apache.lucene.search.Collector getDelegate()
      • setDelegate

        public void setDelegate​(org.apache.lucene.search.Collector delegate)
      • setLastDelegate

        public void setLastDelegate​(org.apache.lucene.search.Collector delegate)
        Sets the last delegate in a chain of DelegatingCollectors
      • setScorer

        public void setScorer​(org.apache.lucene.search.Scorable scorer)
                       throws IOException
        Specified by:
        setScorer in interface org.apache.lucene.search.LeafCollector
        Overrides:
        setScorer in class org.apache.lucene.search.SimpleCollector
        Throws:
        IOException
      • scoreMode

        public org.apache.lucene.search.ScoreMode scoreMode()
      • collect

        public void collect​(int doc)
                     throws IOException
        Specified by:
        collect in interface org.apache.lucene.search.LeafCollector
        Specified by:
        collect in class org.apache.lucene.search.SimpleCollector
        Throws:
        IOException
      • doSetNextReader

        protected void doSetNextReader​(org.apache.lucene.index.LeafReaderContext context)
                                throws IOException
        Overrides:
        doSetNextReader in class org.apache.lucene.search.SimpleCollector
        Throws:
        IOException
      • finish

        public final void finish()
                          throws IOException
        From Solr 9.4 using Lucene 9.8 onwards DelegatingCollector.finish clashes with the super class's LeafCollector.finish method. Please relocate any finishing logic into the DelegatingCollector.complete replacement completion method.
        Throws:
        IOException