I just tried the method. The method is throwing a exception after just passing a solr document of a solr response to the method
My source code: SolrDocument currentDoc = DocumentList.get(f); DocumentObjectBinder binder = new DocumentObjectBinder(); SolrInputDocument inputDoc = binder.toSolrInputDocument(currentDoc) Eception: Exception in thread "main" org.apache.solr.client.solrj.beans.BindingException: class: class org.apache.solr.common.SolrDocument does not define any fields. at org.apache.solr.client.solrj.beans.DocumentObjectBinder.toSolrInputDocument(DocumentObjectBinder.java:78) I don't know why this error is coming up, as the fields are definitely filled (response directly from Solr and the checked the fields too). I'm using now just the old code: public static SolrInputDocument toSolrInputDocument( SolrDocument d ) { SolrInputDocument doc = new SolrInputDocument(); for( String name : d.getFieldNames() ) { doc.addField( name, d.getFieldValue(name), 1.0f ); } return doc; } Seems that the binder is throwing an error here: 72 public SolrInputDocument toSolrInputDocument(Object obj) { 73 List<DocField> fields = getDocFields(obj.getClass()); 74 if (fields.isEmpty()) { 75 throw new BindingException("class: " + obj.getClass() + " does not define any fields."); 76 } 77 Von: Erick Erickson <erickerick...@gmail.com> An: solr-user <solr-user@lucene.apache.org>, Datum: 10.05.2016 17:49 Betreff: Re: Transforming SolrDocument to SolrInputDocument in Solr 6.0 Hmm, looking at the patch I see: DocumentObjectBinder binder = new DocumentObjectBinder(); . . . SolrInputDocument solrInputDoc = binder.toSolrInputDocument(in); But I confess I didn't actually try it. On Tue, May 10, 2016 at 8:41 AM, Stephan Schubert <stephan.schub...@sick.de> wrote: > In Solr 6.0 the method ClientUtils.toSolrInputDocument() was removed > (deprecated since 5.5.1, see > https://issues.apache.org/jira/browse/SOLR-8339). What is the best way now > to transform a SolrDocument into a SolrInputDocument? > > Mit freundlichen Grüßen / Best regards > > Stephan Schubert > Senior Web Application Engineer | IT Engineering Information Oriented > Applications > > > > SICK AG | Erwin-Sick-Str. 1 | 79183 Waldkirch | Germany > Phone +49 7681 202-3751 | stephan.schub...@sick.de | http://www.sick.de > __________________________________________________________________________________________ > > SICK AG | Sitz: Waldkirch i. Br. | Handelsregister: Freiburg i. Br. > HRB 280355 > Vorstand: Dr. Robert Bauer (Vorsitzender) | Reinhard Bösl | Dr. Mats > Gökstorp | Dr. Martin Krämer | Markus Vatter > Aufsichtsrat: Gisela Sick (Ehrenvorsitzende) | Klaus M. Bukenberger > (Vorsitzender) Mit freundlichen Grüßen / Best regards Stephan Schubert Senior Web Application Engineer | IT Engineering Information Oriented Applications SICK AG | Erwin-Sick-Str. 1 | 79183 Waldkirch | Germany Phone +49 7681 202-3751 | Fax | mailto:stephan.schub...@sick.de | http://www.sick.de SICK AG | Sitz: Waldkirch i. Br. | Handelsregister: Freiburg i. Br. HRB 280355 Vorstand: Dr. Robert Bauer (Vorsitzender) | Reinhard Bösl | Dr. Mats Gökstorp | Dr. Martin Krämer | Markus Vatter Aufsichtsrat: Gisela Sick (Ehrenvorsitzende) | Klaus M. Bukenberger (Vorsitzender)