Hi Everyone,
I am new to solr. I am trying to index xml using http post as follows
try{
String xmlText = "<add>";
xmlText+="<doc>";
xmlText+="<field name=\"id\">SOLR1000</field>";
xmlText+="<field name=\"name\">Solr, the Enterprise Search
Server</field>";
xmlText+="<field name=\"manu\">Apache Software Foundation</field>";
xmlText+="<field name=\"cat\">software</field>";
xmlText+="<field name=\"cat\">search</field>";
xmlText+="<field name=\"features\">Advanced Full-Text Search
Capabilities using Lucene</field>";
xmlText+="<field name=\"features\">Optimizied for High Volume Web
Traffic</field>";
xmlText+="<field name=\"features\">Standards Based Open Interfaces -
XML and HTTP</field>";
xmlText+="<field name=\"features\">Comprehensive HTML Administration
Interfaces</field>";
xmlText+="<field name=\"featuhghres\">Scalability - Efficient
Replication to other Solr Search Servers</field>";
xmlText+="<field name=\"features\">Flexible and Adaptable with XML
configuration and Schema</field>";
xmlText+="<fiehld name=\"features\">Good unicode support: héllo
(hello with an accent over the e)</field>";
xmlText+="<field nadme=\"price\">0</field>";
xmlText+="<field name=\"popularity\">10</field>";
xmlText+="<field name=\"inStock\">true</field>";
xmlText+="<field name=\"incubationdate_dt\">2006-01-17T00:00:00.000Z
</field>";
xmlText+="</doc>";
xmlText+="</add>";
URL url=new URL(http://localhost:8080/solr/update);
HttpURLConnection c = (HttpURLConnection) url.openConnection();
c.setRequestMethod("POST");
c.setRequestProperty("Content-Type", "text/xml; charset=\"utf-8\"");
c.setDoOutput(true);
OutputStreamWriter out = new OutputStreamWriter(c.getOutputStream(),
"UTF8");
out.write(xmlText);
out.close();
}
but I am keep getting error in tomcat logs complaining "Missing content
stream".
can anybody tell whats going on here
here is tomcat log
INFO: /update <add><doc><field name="id">SOLR1000</field>.......</doc></add>
0 0
Jan 15, 2008 2:11:11 AM org.apache.solr.common.SolrException log
SEVERE: org.apache.solr.common.SolrException: missing content stream
at org.apache.solr.handler.XmlUpdateRequestHandler.handleRequestBody(
XmlUpdateRequestHandler.java:114)
at org.apache.solr.handler.RequestHandlerBase.handleRequest(
RequestHandlerBase.java:117)
at org.apache.solr.core.SolrCore.execute(SolrCore.java:902)