Can someone please tell me why this code snippet would not add a
document to the Solr index after a "<commit/>" was issued or
please post a snippet of Java code to add a document to the Solr index
that includes the URL reference as a String?
Code example:
String strToAdd =
"<add>
<doc>
<field name="foo">foo</field>
<field name="bar">bar</field>
</doc>
</add>";
URL url = new URL("http://localhost:8080/<your solr app>/update/");
HttpURLConnection urlc = (HttpURLConnection)url.openConnection();
urlc.setRequestMethod("POST");
urlc.setDoOutput(true);
urlc.setRequestProperty("Content-type", "text/xml; charset=UTF-8");
OutputStreamWriter out = new OutputStreamWriter(urlc.getOutputStream());
out.write(strToAdd);
out.flush();
--
Marshall Gunter