iamsanjay commented on PR #13440:
URL: https://github.com/apache/lucene/pull/13440#issuecomment-2139685645
There is one issue that I have faced. To get reference of weight instance in
Collector instance, one can override below method.
```
default void setWeight(Weight weight) {}
```
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,
```
Map<Scorer, Query> mapScQy= new HashMap<Scorer, Query>();
if(weight instanceof BooleanWeight bw){
for(BooleanWeight.WeightedBooleanClause clause:
bw.weightedClauses){
mapScQy.put(clause.weight.scorer(context),
clause.clause.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 `TestSubScorerFreqs.java` and some other parts of
code from the other test cases.
--
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]