madrob commented on code in PR #2927: URL: https://github.com/apache/solr/pull/2927#discussion_r1913952760
########## solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpJdkSolrClient.java: ########## @@ -73,7 +74,7 @@ public class HttpJdkSolrClient extends HttpSolrClientBase { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); private static final String USER_AGENT = - "Solr[" + MethodHandles.lookup().lookupClass().getName() + "] 1.0"; + "Solr[" + MethodHandles.lookup().lookupClass().getName() + "] " + SolrVersion.LATEST_STRING; Review Comment: It's ok to lose the distinction in version number because we still have v1 and v2 clients in the class names? ########## solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java: ########## @@ -1170,6 +1171,21 @@ protected Object _getHandler() { return handler; } + /** Gets the client (user-agent) SolrJ version, or null if isn't SolrJ. */ + public SolrVersion getUserAgentSolrVersion() { + String header = req.getHeader("User-Agent"); + if (header == null || !header.startsWith("Solr")) { + return null; + } + try { + return SolrVersion.valueOf(header.substring(header.lastIndexOf(' ') + 1)); Review Comment: If this gets an older client it will return 1.0 or 2.0, which can be somewhat misleading. -- 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