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 Ismail Siddiqui <is...@gmail.com> on 2008/01/15 19:50:25 UTC
Missing Content Stream
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)
Re: Missing Content Stream
Posted by Ismail Siddiqui <is...@gmail.com>.
I am trying solrj to index.. using follwing code
String url = "http://localhost:8080/solr";
SolrServer server = new CommonsHttpSolrServer( url );
its giving error that undifined symbol for constructor(string). can somoen
tell me why this constructor thrwoing error while in source file i can
clearly see this constructor
thanks
On 1/15/08, Ismail Siddiqui <is...@gmail.com> wrote:
>
> thanks brian and otis,
> i will definitely try solrj.. but actaually now the problem is resolved by
> setting content length in header i was missing it
> c.setRequestProperty("Content-Length", xmlText.length()+"");
> but now its not throwing any error but not indexing the document either..
> do I have to set autoCommit on in solrconfig.xml ???
>
>
> thanks
>
>
> On 1/15/08, Brian Whitman <br...@variogr.am> wrote:
> >
> >
> > On Jan 15, 2008, at 1:50 PM, Ismail Siddiqui wrote:
> >
> > > Hi Everyone,
> > > I am new to solr. I am trying to index xml using http post as follows
> >
> >
> > Ismail, you seem to have a few spelling mistakes in your xml string.
> > "fiehld, nadme" etc. (a) try fixing them, (b) try solrj instead, I
> > agree w/ otis.
> >
> >
> >
> >
>
Re: Missing Content Stream
Posted by Ismail Siddiqui <is...@gmail.com>.
thanks brian and otis,
i will definitely try solrj.. but actaually now the problem is resolved by
setting content length in header i was missing it
c.setRequestProperty("Content-Length", xmlText.length()+"");
but now its not throwing any error but not indexing the document either.. do
I have to set autoCommit on in solrconfig.xml ???
thanks
On 1/15/08, Brian Whitman <br...@variogr.am> wrote:
>
>
> On Jan 15, 2008, at 1:50 PM, Ismail Siddiqui wrote:
>
> > Hi Everyone,
> > I am new to solr. I am trying to index xml using http post as follows
>
>
> Ismail, you seem to have a few spelling mistakes in your xml string.
> "fiehld, nadme" etc. (a) try fixing them, (b) try solrj instead, I
> agree w/ otis.
>
>
>
>
Re: Missing Content Stream
Posted by Brian Whitman <br...@variogr.am>.
On Jan 15, 2008, at 1:50 PM, Ismail Siddiqui wrote:
> Hi Everyone,
> I am new to solr. I am trying to index xml using http post as follows
Ismail, you seem to have a few spelling mistakes in your xml string.
"fiehld, nadme" etc. (a) try fixing them, (b) try solrj instead, I
agree w/ otis.