Hi Nithya

I'm new to this myself and I'm sure there are other ways to POST to solr but
here's one way. This uses the Apache commons HttpClient - downloaded from
http://jakarta.apache.org/commons/httpclient/
You need to change the first parameter to the StringRequestEntity
constructor to use a string containing your xml document.
I can't help with Tomcat configuration - I haven't used it for solr.


Cheers

Vince


HttpClient client = new HttpClient();
PostMethod method = new PostMethod("http://localhost:8983/solr/update";);
RequestEntity requestBody = new StringRequestEntity(xmlDoc.asXML(),
        "text/xml;      charset=UTF-8","UTF-8");
method.setRequestEntity(requestBody);
client.executeMethod(method);
String response = null;
if (method.getStatusCode() == 200){
        response = method.getResponseBodyAsString();
        LOGGER.debug("RESPONSE " + response);
}

requestBody = new StringRequestEntity("<commit/>","text/xml;
charset=UTF-8","UTF-8");
method.setRequestEntity(requestBody);
client.executeMethod(method);
if (method.getStatusCode() == 200){
        response = method.getResponseBodyAsString();
        LOGGER.debug("RESPONSE " + response);
}
method.releaseConnection();




-----Original Message-----
From: nithyavembu [mailto:[EMAIL PROTECTED] 
Sent: 06 July 2007 06:27
To: solr-user@lucene.apache.org
Subject: Solr Server Configuration


Hi All,

  I am new to Solr. But i am familiar with lucene.
 I am stuggling in solr server configuation.I am using Tomcat 5. I have
worked with the "example"   standalone given with solr while i download.
 But my doubt is 
  i) In lucene we add document  by using java. But here they given in xml
format and posting them using  POST.jar. How can i add document in java?
 ii) How can i send the http request n get response in a standalone java
program?
 iii) Whether i have to add any xml or i have to modify the xml
(server.xml,web.xml) files for solr server configuration?


Best,
Nithya.V.
-- 
View this message in context:
http://www.nabble.com/Solr-Server-Configuration-tf4033748.html#a11458997
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to