ercsonusharma commented on code in PR #3418: URL: https://github.com/apache/solr/pull/3418#discussion_r2352867177
########## solr/core/src/java/org/apache/solr/handler/component/HttpShardHandler.java: ########## @@ -500,6 +505,28 @@ public void prepDistributed(ResponseBuilder rb) { } } + private static void forceDistributed(ResponseBuilder rb) { + SolrQueryRequest req = rb.req; + ModifiableSolrParams solrParams = new ModifiableSolrParams(req.getParams()); + solrParams.set("shortCircuit", false); + req.setParams(solrParams); + if (req.getHttpSolrCall() != null + && StringUtils.isEmpty(req.getParams().get(ShardParams.SHARDS))) { + String scheme = req.getHttpSolrCall().getReq().getScheme(); + String host = req.getHttpSolrCall().getReq().getServerName(); + int port = req.getHttpSolrCall().getReq().getServerPort(); + String context = req.getHttpSolrCall().getReq().getContextPath(); + String core = req.getCore().getName(); + String localShardUrl = + String.format(Locale.ROOT, "%s://%s:%d%s/%s", scheme, host, port, context, core); + solrParams.set(ShardParams.SHARDS, localShardUrl); + req.setParams(solrParams); + return; + } Review Comment: No, shortCircuit=false is not enough as ShardHandler also [needs the `shards` parameter](https://github.com/apache/solr/blob/main/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandler.java#L483) which comes directly from SolrParams. While, making shortCircuit=true makes [the rb.isDistrib=false ](https://github.com/apache/solr/blob/main/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandler.java#L449) and force the method to not go through the shardHandler requests, rather stick to [node local indexes](https://github.com/apache/solr/blob/main/solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java#L493) through SearchComponent.process method. I couldn't find this code anywhere but created myself. -- 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: issues-unsubscr...@solr.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For additional commands, e-mail: issues-h...@solr.apache.org