On 7/6/2013 4:27 PM, Steven Glass wrote:
Thanks for your response.But it seems like there should be a way to issue the equivalent of http://localhost:8983/solr/schema/version which returns { "responseHeader":{ "status":0, "QTime":4}, "version":1.5} from the server. I know how to do it using HTTPGet in Android, but I can't use that in my desktop app because sometimes I'm connected to a local set of files using an embedded SolrJ server. It seems silly to write a bunch of code to parse the files myself when Solr already does it so well. There does not seem to be a request handler to use to issue such a call nor a direct API. Has anyone ever gotten this information from the server using SolrJ?
This code works against a 4.4-SNAPSHOT server. I believe that parts of the schema REST API are in 4.3.1, so this will likely work against that version too:
String url = "http://server:port/solr/corename"; SolrServer server = new HttpSolrServer(url); SolrQuery query = new SolrQuery(); query.setRequestHandler("/schema/version"); QueryResponse response = server.query(query); float version = (float) response.getResponse().get("version"); System.out.println(version); Thanks, Shawn
