CandidateMatcher public matching functions #13632
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
In
CandidateMatcher
, increase visibility ofmatchQuery()
(from protected),finish()
andreportError()
(from package-private) to public, so that aCandidateMatcher
can be used effectively from outside theorg.apache.lucene.monitor
package.Problem
The current access protections on
CandidateMatcher
make it infeasible for a user of the Lucene Monitor library to use an existingCandidateMatcher
if they are outside theorg.apache.lucene.monitor
package (e.g. as part of the implementation of their ownCandidateMatcher
).For example, a user working outside of the
org.apache.lucene.monitor
package could not build their own version ofParallelMatcher
by making use of the matcher fromQueryMatch.SIMPLE_MATCHER
, because they cannot accessmatchQuery
,reportError
orfinish
on it.Solution
This PR takes the simplest solution of increase the visibility of those functions in
CandidateMatcher
topublic
. This also requires modifying some existingCandidateMatcher
implementations that overrideprotected matchQuery()
to instead overridepublic matchQuery()
.I've also added some just-compile tests in a subpackage
org.apache.lucene.monitor.otherpackage
, which call the newly-public functions to verify that they are accessible from outside theorg.apache.lucene.monitor
package.See previous discussion of this approach and alternatives in #13109.
Merge Request
If this PR gets merged, can you please use my
[email protected]
email address for the squash+merge. Thank you.