-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Removed Scorer#getWeight #13440
Removed Scorer#getWeight #13440
Conversation
There is one issue that I have faced. To get reference of weight instance in Collector instance, one can override below method.
For BooleanWeight instance, I tried to create a Map.of(Scorer, Query) in above method and then use it setScorer to fetch the query as getWeight is not available now and therefore no way to fetch the respective query,
However, the scorer object that I found inside BooleanWeight#WeightedBooleanClause and the one with which setScorer is called, both are different. My point is that yes you can have get access to weight instance, However, It is not possible to fetch the Query for which that Scorer was created. IMO, It's not possible to create the Map and then use it in collect method. Consequently I removed |
Could you also look into removing Regarding TestSubScorerFreqs, does using |
Yup I am on it! Total 49 usages as per quick IntelliJ search.
Okay, I will check If switching to ScorerIndexSearcher can help me getting same Scorer. Thanks! |
@jpountz We are also removing weight from Subclasses of Scorer as well, right? Because I already removed from good amount of classes such as ConstantScoreScorer and few others. Just want to make sure before moving ahead. |
|
Yes, that would be great. If there are a few sub classes that really need a Weight, we could keep it, it looks like you identitfied a few of them already. |
For those that are in the
Good question. Your change looks good this way, but I know Solr is a heavy user of
Yes. It looks like it was only there to be able to pass the Weight to a Scorer constructor. |
It's not clear why Solr would care with regards to FunctionValues & Weights in particular. I don't notice Solr using Weights there but maybe I'm not looking in quite the right spot? if Scorer.getWeight is being removed, I only see a couple places in Solr where this is used, both in LTR, interestingly. This shouldn't stop Lucene from doing what it ought to do. |
Maybe it doesn't use them, I was just trying to be careful since I believe that Solr is using the
Thanks for the guidance, this is the sort of feedback I was looking for. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
lucene/CHANGES.txt
Outdated
@@ -458,7 +460,8 @@ API Changes | |||
IndexSearcher#search(Query, CollectorManager) for TopFieldCollectorManager | |||
and TopScoreDocCollectorManager. (Zach Chen, Adrien Grand, Michael McCandless, Greg Miller, Luca Cavanna) | |||
|
|||
* GITHUB#12854: Mark DrillSideways#createDrillDownFacetsCollector as @Deprecated. (Greg Miller) | |||
* GITHUB#12854: Mark DrillSideways#createDrillDownFacetsCollector as @ | |||
Deprecated. (Greg Miller) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Undo the new line?
Thank you! |
Since apache/lucene#13440 Scorers don't keep track of a Weight any longer, so the constructor doesn't exist any longer and callers need to track the Weight if needed. So far I don't think we have any cases of this.
Description
Closes #13410
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 as @jpountz mentioned in the comment as well.