Skip to content

Tests: TestLongNormValueSource, AssertingScorable - #14448

Merged
dsmiley merged 2 commits into
apache:mainfrom
dsmiley:TestLongNormValueSource
Apr 9, 2025
Merged

Tests: TestLongNormValueSource, AssertingScorable#14448
dsmiley merged 2 commits into
apache:mainfrom
dsmiley:TestLongNormValueSource

Conversation

@dsmiley

@dsmiley dsmiley commented Apr 7, 2025

Copy link
Copy Markdown
Contributor

TestLongNormValueSource: test specifics
AssertingScorable: don't wrap needlessly

AssortingScorable: don't wrap needlessly

public static Scorable wrap(Scorable in) {
if (in instanceof AssertingScorable) {
if (in instanceof WrappedScorer || in instanceof AssertingScorable) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this part of the change, this method expects the returned Scorable to have assertions enabled, but it may not be the case if this is an instance of WrappedScorer?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment below explains why a WrappedScorer is used sometimes. It doesn't make sense to have a WrappedScorer around a WrappedScorer (right?).

I encountered this issue while running the other test in a debugger. So much wrapping!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for explaining, there can be much wrapping indeed. I had missed that AssertingScorable would sometimes do this, I opened a PR that hopefully cleans this up a bit. #14452

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice :-)

@jpountz jpountz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM


public static Scorable wrap(Scorable in) {
if (in instanceof AssertingScorable) {
if (in instanceof WrappedScorer || in instanceof AssertingScorable) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for explaining, there can be much wrapping indeed. I had missed that AssertingScorable would sometimes do this, I opened a PR that hopefully cleans this up a bit. #14452

@dsmiley
dsmiley merged commit a74d85c into apache:main Apr 9, 2025
jpountz pushed a commit to jpountz/lucene that referenced this pull request Apr 24, 2025
TestLongNormValueSource: improve
AssortingScorable: don't wrap needlessly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants