lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tod <listac...@gmail.com>
Subject Batch indexing documents using ContentStreamUpdateRequest
Date Fri, 04 Nov 2011 16:36:11 GMT
This is a code fragment of how I am doing a ContentStreamUpdateRequest 
using CommonHTTPSolrServer:


   ContentStreamBase.URLStream csbu = new ContentStreamBase.URLStream(url);
   InputStream is = csbu.getStream();
   FastInputStream fis = new FastInputStream(is);

   csur.addContentStream(csbu);
   csur.setParam("literal.content_id","000000");
   csur.setParam("literal.contentitle","This is a test");
   csur.setParam("literal.title","This is a test");
   server.request(csur);
   server.commit();

   fis.close();


This works fine for one document (a pdf in this case).  When I surround 
this with a while loop and try adding multiple documents I get:

org.apache.solr.client.solrj.SolrServerException: java.io.IOException: 
stream is closed

I've tried commenting out the fis.close, and also using just a plain 
InputStream with and without a .close() call - neither work.  Is there a 
way to do this that I'm missing?


Thanks - Tod

Mime
View raw message