dsmiley commented on code in PR #1244:
URL: https://github.com/apache/solr/pull/1244#discussion_r2198765440
##########
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:
The sorting & mapping has to happen somewhere. It's inelegant. Is your
point to add a convenience API/method? If we do this in multiple places, then
that'd make sense, but not otherwise.
--
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]