You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Marc SCHNEIDER <ma...@gmail.com> on 2011/04/05 11:46:30 UTC
Solrj and display which Solr version is used
Hi,
I'm wondering how to find out which version of Solr is currently running
using the Solrj library?
Thanks,
Marc.
Re: Solrj and display which Solr version is used
Posted by Marc SCHNEIDER <ma...@gmail.com>.
Ok thanks, that's an idea :-)
Maybe we should suggest to have a method in CommonsHttpSolrServer that is
returning Solr's version...
Marc.
On Wed, Apr 6, 2011 at 2:58 PM, Erick Erickson <er...@gmail.com>wrote:
> The only way I know of (and it's a little, well, a lot arcane)
> is to ping the admin/system handler. As it happens, I just
> had to do something like this. This uses apache commons
> http client 3X, NOT the most recent FWIW...
> The URl can be admin/<see solrconfig.xml>
>
> I'd really like to find out that there's an easier way. This brings
> back everything on the "admin/info" page.
>
> public static void main(String[] args) {
> HttpMethod method = new GetMethod("
> http://localhost:8983/solr/admin/system");
> try {
> CommonsHttpSolrServer server = new CommonsHttpSolrServer("
> http://localhost:8888");
> HttpClient client = server.getHttpClient();
>
> int statusCode = client.executeMethod(method);
> // Really, you'd want to do something here.
> byte[] responseBody = method.getResponseBody();
> System.out.println(new String(responseBody));
>
> } catch (Exception e) {
> e.printStackTrace();
> } finally {
> // Release the connection.
> method.releaseConnection();
> }
> }
>
> On Tue, Apr 5, 2011 at 5:46 AM, Marc SCHNEIDER
> <ma...@gmail.com>wrote:
>
> > Hi,
> >
> > I'm wondering how to find out which version of Solr is currently running
> > using the Solrj library?
> >
> > Thanks,
> > Marc.
> >
>
Re: Solrj and display which Solr version is used
Posted by Erick Erickson <er...@gmail.com>.
The only way I know of (and it's a little, well, a lot arcane)
is to ping the admin/system handler. As it happens, I just
had to do something like this. This uses apache commons
http client 3X, NOT the most recent FWIW...
The URl can be admin/<see solrconfig.xml>
I'd really like to find out that there's an easier way. This brings
back everything on the "admin/info" page.
public static void main(String[] args) {
HttpMethod method = new GetMethod("
http://localhost:8983/solr/admin/system");
try {
CommonsHttpSolrServer server = new CommonsHttpSolrServer("
http://localhost:8888");
HttpClient client = server.getHttpClient();
int statusCode = client.executeMethod(method);
// Really, you'd want to do something here.
byte[] responseBody = method.getResponseBody();
System.out.println(new String(responseBody));
} catch (Exception e) {
e.printStackTrace();
} finally {
// Release the connection.
method.releaseConnection();
}
}
On Tue, Apr 5, 2011 at 5:46 AM, Marc SCHNEIDER
<ma...@gmail.com>wrote:
> Hi,
>
> I'm wondering how to find out which version of Solr is currently running
> using the Solrj library?
>
> Thanks,
> Marc.
>