ercsonusharma commented on code in PR #4476:
URL: https://github.com/apache/solr/pull/4476#discussion_r3353548513


##########
solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.java:
##########
@@ -488,6 +489,45 @@ public void prepare(ResponseBuilder rb) throws IOException 
{
       return;
     }
 
+    if (rb instanceof CombinedQueryResponseBuilder crb) {
+      prepareCombined(crb);
+    } else {
+      prepareElevationComponent(rb);
+    }
+  }
+
+  /**
+   * Elevates each subquery and mirrors the resulting SortSpec/filters onto 
the parent crb so {@link
+   * CombinedQueryComponent#mergeIds} can read {@code _elevate_} from each 
shard's {@code
+   * sort_values_i} during distributed merge.
+   */
+  private void prepareCombined(CombinedQueryResponseBuilder crb) throws 
IOException {
+    if (crb.responseBuilders.isEmpty()) {
+      return;
+    }
+    for (ResponseBuilder thisRb : crb.responseBuilders) {
+      prepareElevationComponent(thisRb);
+    }
+    // Subqueries get identical elevation treatment, so any one is 
representative.
+    ResponseBuilder representative = crb.responseBuilders.getFirst();
+    crb.setSortSpec(representative.getSortSpec());
+    crb.setFilters(representative.getFilters());
+
+    if (crb.isDebug() && crb.isDebugQuery()) {

Review Comment:
   Debug handling was already part of this component 
[here](https://github.com/apache/solr/blob/main/solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.java#L498).
 All this block does is pick up the entry this very component wrote on each 
sub-rb and roll it onto the parent rb so the combined response shows it.



-- 
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]

Reply via email to