java.lang.Object
org.apache.lucene.sandbox.search.ProfilerCollector
- All Implemented Interfaces:
Collector
This class wraps a Collector and times the execution of: - setScorer() - collect() -
doSetNextReader() - needsScores()
QueryProfiler facilitates the linking of the Collector graph
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final List
<ProfilerCollector> A list of "embedded" children collectorsprivate final ProfilerCollectorWrapper
The wrapped collectorprivate final String
A more friendly representation of the Collector's class nameprivate final String
A "hint" to help provide some context about this Collector -
Constructor Summary
ConstructorsConstructorDescriptionProfilerCollector
(Collector collector, String reason, List<ProfilerCollector> children) -
Method Summary
Modifier and TypeMethodDescriptionprotected String
Creates a human-friendly representation of the Collector name.private static ProfilerCollectorResult
doGetCollectorTree
(ProfilerCollector collector) getLeafCollector
(LeafReaderContext context) Create a newcollector
to collect the given context.getName()
long
getTime()
Indicates what features are required from the scorer.void
Set theWeight
that will be used to produce scorers that will feedLeafCollector
s.
-
Field Details
-
collectorName
A more friendly representation of the Collector's class name -
reason
A "hint" to help provide some context about this Collector -
collector
The wrapped collector -
children
A list of "embedded" children collectors
-
-
Constructor Details
-
ProfilerCollector
-
-
Method Details
-
getTime
public long getTime()- Returns:
- the profiled time for this collector (inclusive of children)
-
getReason
- Returns:
- a human readable "hint" about what this collector was used for
-
getName
- Returns:
- the lucene class name of the collector
-
deriveCollectorName
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
Description copied from interface:Collector
Create a newcollector
to collect the given context.- Specified by:
getLeafCollector
in interfaceCollector
- Parameters:
context
- next atomic reader context- Throws:
IOException
-
setWeight
Description copied from interface:Collector
Set theWeight
that will be used to produce scorers that will feedLeafCollector
s. This is typically useful to have access toWeight.count(org.apache.lucene.index.LeafReaderContext)
fromCollector.getLeafCollector(org.apache.lucene.index.LeafReaderContext)
. -
scoreMode
Description copied from interface:Collector
Indicates what features are required from the scorer. -
getProfileResult
-
doGetCollectorTree
-