Hello - we use GZipped output streams too for buffering large sets of SolrInputDocument's to disk before indexing. Works fine and SolrInputDocument is very easily compressed as well.
Markus -----Original message----- > From:Sebastian Riemer <s.rie...@littera.eu> > Sent: Thursday 30th June 2016 13:56 > To: solr-user@lucene.apache.org > Subject: How to best serialize/deserialize a SolrInputDocument? > > Hi, > > I am looking for a way to serialize a SolrInputDocument. > > I want to store the serialized document in a MySQL table. > > Later I want to deserialize that document and send it to the Solr server. > > Currently I am looking at org.apache.solr.client.solrj.request.UpdateRequest > and JavaBinUpdateRequestCodec. There are two methods, marshal and unmarshal > which look like I could use for that purpose. > > I'd simply create an UpdateRequest, add the document to it, call marshal, > save the OutputStream somehow in the MySQL table. When retrieving I pass the > value from the MySQL as InputStream to the unmarshal method, get my > UpdateRequest object, iterate the contained SolrInputDocument and send it to > the server. > > Am I on the right track, or is there a better approach? > > The background to this is, that we want backup the generated documents which > are indexed with solr. So if a client restores a backup, that MySQL table > with the serialized documents can be used to rebuild the index as quickly as > possible. > > Thanks, > Sebastian > > >