janhoy commented on code in PR #2666: URL: https://github.com/apache/solr/pull/2666#discussion_r1776427386
########## solr/core/src/java/org/apache/solr/handler/component/HttpShardHandler.java: ########## @@ -80,6 +94,39 @@ public HttpShardHandler(HttpShardHandlerFactory httpShardHandlerFactory) { shardToURLs = new HashMap<>(); } + /** + * Parse the {@value ShardParams#SHARDS_TOLERANT} param from <code>params</code> as a boolean; + * accepts {@value ShardParams#REQUIRE_ZK_CONNECTED} as a valid value indicating <code>false + * </code>. + * + * <p>By default, returns <code>false</code> when {@value ShardParams#SHARDS_TOLERANT} is not set + * in <code> + * params</code>. + */ + public static boolean getShardsTolerantAsBool(SolrQueryRequest req) { + String shardsTolerantValue = req.getParams().get(ShardParams.SHARDS_TOLERANT); + if (null == shardsTolerantValue + || shardsTolerantValue.trim().equals(ShardParams.REQUIRE_ZK_CONNECTED)) { Review Comment: So, this param may come from http url param or it may come from default section on a request handler in solrcobfig. If the latter, the `true` string may contain white space if the xml is «indented». We could not trim() all xml values, since sometimes white space is significant. Perhaps a more readable code would be to not do plain string comparison here but use a utility method boolCompareTrim() or similar? I have not looked into the code base this time around, but I seem to remember there was no obvious clean location to normalize these bool-strings during config parse.. -- 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