Closed iamsanjay closed 1 month ago
scorerSupplier has to be null if scorer is null. Therefore scorer was initialized inside the scorerSupplier, instead of scorerSupplier.get method. And if scorer evaluates to null then scorerSupplier would return null.
Instead of both get() and cost() throwing the exception, Can make scorerSupplier throw UnsupportedOperationException()
?
@Override
public ScorerSupplier scorerSupplier(LeafReaderContext context) throws IOException {
throw new UnsupportedOperationException();
}
Instead of both get() and cost() throwing the exception, Can make scorerSupplier throw UnsupportedOperationException()?
In general yes, there may be a few exceptions though like JustCompileSearch
where we want to keep these methods since it's about detecting API changes.
In general yes, there may be a few exceptions though like
JustCompileSearch
where we want to keep these methods since it's about detecting API changes.
Okay in that case, let's make cost method throw an exception.
I also changed scorerSupplier in few classes to delegate it to scorerSupplier instead of scorer.
On a side note, I faced an issue where it got stuck in an infinite loop. The reason because scorerSupplier was calling super.scorer()
and then scorer was delegating it to scorerSupplier
. I wonder If it's a design issue? And, How can we change the existing design So that It won't happen?
Description
13180
This PR would declare the scoreSupplier method abstract and marked scorer final. The nature of the change itself is not complex, however the large number of files has been modified with this change.
Few Observations: