Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Scorer#getWeight. #13410

Closed
jpountz opened this issue May 24, 2024 · 3 comments · Fixed by #13440
Closed

Remove Scorer#getWeight. #13410

jpountz opened this issue May 24, 2024 · 3 comments · Fixed by #13440
Milestone

Comments

@jpountz
Copy link
Contributor

jpountz commented May 24, 2024

Description

I've been working on some refactorings recently, and the fact that Scorer has a getWeight method is very annoying as it requires every simple Scorer implementation, e.g. for testing purposes, to also be able to return its Weight.

This method doesn't have strong use-cases, so I suggest that we remove it for 10.0.

@jpountz jpountz added this to the 10.0.0 milestone May 24, 2024
@navneet1v
Copy link
Contributor

@jpountz what would be the alternative to getWeight function?

@romseygeek
Copy link
Contributor

+1

I'd also look at removing Scorable.getChildren() which we use in a few tests in tandem with getWeight(). We now have several composite scorer implementations that don't advance all subscorers for performance reasons, and we also have QueryVisitor and Matches APIs for getting information about sub-queries, so I don't think this API is very useful anymore.

@jpountz
Copy link
Contributor Author

jpountz commented May 27, 2024

@navneet1v Since a Scorer must be created from a Weight, callers would be expected to keep track of the Weight that created the Scorer if they need it instead of relying on Lucene to do this.

jpountz pushed a commit that referenced this issue Jun 6, 2024
If Caller requires Weight then they have to keep track of Weight with which Scorer was created in the first place instead of relying on Scorer.

Closes #13410
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants