gerlowskija commented on code in PR #1808: URL: https://github.com/apache/solr/pull/1808#discussion_r1274883703
########## solr/core/src/java/org/apache/solr/cli/SolrCLI.java: ########## @@ -445,8 +450,31 @@ private static void printHelp() { print("Pass -help or -h after any COMMAND to see command-specific usage information,"); print("such as: ./solr start -help or ./solr stop -h"); } + + /** + * Strips off the end of solrUrl any /solr when a legacy solrUrl like http://localhost:8983/solr + * is used, and warns those users. In the future we'll have url's with /api as well. + * + * @param solrUrl with /solr stripped off. + * @return the truncated if need solrUrl. + */ + public static String resolveSolrUrl(String solrUrl) { + if (solrUrl != null) { + if (solrUrl.indexOf("/solr") > -1) { // + solrUrl = solrUrl.substring(0, solrUrl.indexOf("/solr")); + CLIO.out( + "The solrUrl parameter only needs to only point to the root of Solr (" Review Comment: [-0] I think this message would read more clearly if you dropped the second "only". [0] Maybe add some indication in this message that Solr is able to auto-correct the URL for folks, so they don't see the warning and think the command has failed. e.g. > 'solrUrl' needn't include Solr's context-root (e.g. "/solr"); correcting from [old] to [new] ########## solr/core/src/java/org/apache/solr/cli/SolrCLI.java: ########## @@ -383,6 +383,11 @@ public static boolean exceptionIsAuthRelated(Exception exc) { } public static SolrClient getSolrClient(String solrUrl) { + // today we require all urls to end in /solr, however in the future we will need to support the + // /api url end point instead. + if (!solrUrl.endsWith(("/solr"))) { Review Comment: [0] Not sure whether this is intended or not, but if the provided URL was `http://localhost:8983/solr/` (not the ending '/') we'd still append`/solr`. I wonder if there isn't some Java utility for adding path segments to a URL that can be a little smarter about some of the edge cases (handling adjacent forward slashes, etc.) -- 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