Class ProfilerCollector

java.lang.Object
org.apache.lucene.sandbox.search.ProfilerCollector
All Implemented Interfaces:
Collector

public class ProfilerCollector extends Object implements Collector
This class wraps a Collector and times the execution of: - setScorer() - collect() - doSetNextReader() - needsScores()

QueryProfiler facilitates the linking of the Collector graph

  • Field Details

    • collectorName

      private final String collectorName
      A more friendly representation of the Collector's class name
    • reason

      private final String reason
      A "hint" to help provide some context about this Collector
    • collector

      private final ProfilerCollectorWrapper collector
      The wrapped collector
    • children

      private final List<ProfilerCollector> children
      A list of "embedded" children collectors
  • Constructor Details

  • Method Details

    • getTime

      public long getTime()
      Returns:
      the profiled time for this collector (inclusive of children)
    • getReason

      public String getReason()
      Returns:
      a human readable "hint" about what this collector was used for
    • getName

      public String getName()
      Returns:
      the lucene class name of the collector
    • deriveCollectorName

      protected String deriveCollectorName(Collector c)
      Creates a human-friendly representation of the Collector name. Override to customize how the name is derived.
      Parameters:
      c - The Collector to derive a name from
      Returns:
      A (hopefully) prettier name
    • getLeafCollector

      public LeafCollector getLeafCollector(LeafReaderContext context) throws IOException
      Description copied from interface: Collector
      Create a new collector to collect the given context.
      Specified by:
      getLeafCollector in interface Collector
      Parameters:
      context - next atomic reader context
      Throws:
      IOException
    • scoreMode

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

      public ProfilerCollectorResult getProfileResult()
    • doGetCollectorTree

      private static ProfilerCollectorResult doGetCollectorTree(ProfilerCollector collector)