Skip to content

[Feature Request] Add getWrappedScorer() method to ProfileScorer for consistency with ProfileCollector #20548

@martin-gaievski

Description

@martin-gaievski

Is your feature request related to a problem? Please describe

ProfileCollector has a getDelegate() method to access the wrapped collector, and ProfilingAggregator has unwrapAggregator(). However, ProfileScorer lacks an equivalent method to access the wrapped scorer.

Use Case: Plugin queries (like neural-search's HybridQuery) may expose custom methods on their Scorer implementations that are not part of the standard Lucene Scorer API. When profiling is enabled, these queries cannot access their custom methods because ProfileScorer wraps the original scorer.

Describe the solution you'd like

Add getWrappedScorer() method to ProfileScorer, consistent with the existing ProfileCollector.getDelegate() pattern. Risk are same as existing unwrap patterns - callers bypassing the wrapper lose profiling instrumentation for those calls, but functional correctness is preserved.

Related component

Search:Query Capabilities

Describe alternatives you've considered

We don't have profiler for hybrid query hosted in neural-search plugin. We can access the wrapped scorers via reflection, but this solution is quite fragile (fail if package or class name changes in core, access to private class variable can be blocked due to security concerns), and not really performant comparing to direct method calls

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions