jpountz commented on PR #12490:
URL: https://github.com/apache/lucene/pull/12490#issuecomment-1666879261
To give a bit more context about why I ended up adding
`ScorerSupplier#setTopLevelScoringClause`: I considered other options, such as:
- adding a new `ScoreMode` but `Query#createWeight` is too early to make
this kind of decision. E.g. if your query is `a OR b`, `a` may be the top-level
scoring clause if `b` produces a null scorer, so `createWeight` is not a good
fit.
- adding a new parameter to `Weight#scorer`, but again it's too early for
the same reason. With query `a OR b`, if Lucene creates a scorer for `a` first
assuming it will be a clause of a boolean query, but if then `b` produces a
`null` scorer, `a` will be the top-level scoring clause, but it's already been
created as a non-top-level scoring clause.
- adding a similar `setTopLevelScoringClause` on `Scorer`, but I did not
like mutating scorers
So a setter on `ScorerSupplier` felt like the best place to set this kind of
information.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]