AndreyBozhko commented on code in PR #1244:
URL: https://github.com/apache/solr/pull/1244#discussion_r2202025727
##########
solr/core/src/java/org/apache/solr/response/transform/ValueSourceAugmenter.java:
##########
@@ -68,20 +70,44 @@ public void setContext(ResultContext context) {
fcontext = ValueSource.newContext(searcher);
this.valueSource.createWeight(fcontext, searcher);
final var docList = context.getDocList();
- if (docList == null) {
+ final int prefetchSize = docList == null ? 0 : Math.min(docList.size(),
maxPrefetchSize);
+ if (prefetchSize == 0) {
return;
}
- final int prefetchSize = Math.min(docList.size(), maxPrefetchSize);
+ // Check if scores are wanted and initialize the Scorable if so
+ final MutableScorable scorable; // stored in fcontext (when not null)
+ final IntFloatHashMap docToScoreMap;
+ if (context.wantsScores()) { // TODO switch to ValueSource.needsScores
once it exists
+ docToScoreMap = new IntFloatHashMap(prefetchSize);
Review Comment:
It looked to me that the mapping between docIds and scores is already
established in the DocList (so why do the mapping again?), and only the sorting
piece is missing. That's why I was thinking of a way to handle just the sorting.
But I agree - if this is the only place, then I'm OK with the logic as long
as it works.
--
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]