ercsonusharma commented on code in PR #3418:
URL: https://github.com/apache/solr/pull/3418#discussion_r2187355067
##########
solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java:
##########
@@ -1162,14 +1164,29 @@ protected void mergeIds(ResponseBuilder rb,
ShardRequest sreq) {
// the docs offset -> queuesize
int resultSize = queue.size() - ss.getOffset();
resultSize = Math.max(0, resultSize); // there may not be any docs in range
-
Map<Object, ShardDoc> resultIds = new HashMap<>();
- for (int i = resultSize - 1; i >= 0; i--) {
- ShardDoc shardDoc = queue.pop();
- shardDoc.positionInResponse = i;
- // Need the toString() for correlation with other lists that must
- // be strings (like keys in highlighting, explain, etc)
- resultIds.put(shardDoc.id.toString(), shardDoc);
+
+ if (rb instanceof CombinedQueryResponseBuilder) {
+ QueryAndResponseCombiner combinerStrategy =
+ QueryAndResponseCombiner.getImplementation(rb.req.getParams());
+ List<ShardDoc> combinedShardDocs = combinerStrategy.combine(shardDocMap);
+ maxScore = 0.0f;
+ for (int i = 0; i < resultSize; i++) {
+ ShardDoc shardDoc = combinedShardDocs.get(i);
+ shardDoc.positionInResponse = i;
+ maxScore = Math.max(maxScore, shardDoc.score);
+ // Need the toString() for correlation with other lists that must
+ // be strings (like keys in highlighting, explain, etc)
+ resultIds.put(shardDoc.id.toString(), shardDoc);
+ }
+ } else {
+ for (int i = resultSize - 1; i >= 0; i--) {
+ ShardDoc shardDoc = queue.pop();
+ shardDoc.positionInResponse = i;
+ // Need the toString() for correlation with other lists that must
+ // be strings (like keys in highlighting, explain, etc)
+ resultIds.put(shardDoc.id.toString(), shardDoc);
+ }
Review Comment:
Thanks for the input. This makes sense to me, and I have refactored out the
method to leverage overriding.
--
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]