[ https://issues.apache.org/jira/browse/SOLR-536?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Noble Paul updated SOLR-536: ---------------------------- Attachment: SOLR-DocObjBinder.patch user reported bug I have a multivalued Solr text field, called 'categories', which is mapped to a String[] in my java bean. I am directly converting the search results to this bean. This works absolutely fine if the field has two or more values, but If the field has exactly one value, I get the following exception - *Caused by: java.lang.RuntimeException: Exception while setting value : [Ljava.lang.Object;@15b48b2 on private java.lang.String[] com.app.model.Unit.categories at org.apache.solr.client.solrj.beans.DocumentObjectBinder$DocField.set(DocumentObjectBinder.java:230) at org.apache.solr.client.solrj.beans.DocumentObjectBinder$DocField.inject(DocumentObjectBinder.java:199) at org.apache.solr.client.solrj.beans.DocumentObjectBinder.getBeans(DocumentObjectBinder.java:57) at org.apache.solr.client.solrj.response.QueryResponse.getBeans(QueryResponse.java:256) Fixed > Automatic binding of results to Beans (for solrj) > ------------------------------------------------- > > Key: SOLR-536 > URL: https://issues.apache.org/jira/browse/SOLR-536 > Project: Solr > Issue Type: New Feature > Components: clients - java > Affects Versions: 1.3 > Reporter: Noble Paul > Assignee: Ryan McKinley > Priority: Minor > Fix For: 1.3 > > Attachments: SOLR-536.patch, SOLR-536.patch, SOLR-536.patch, > SOLR-536.patch, SOLR-DocObjBinder.patch > > > as we are using java5 .we can use annotations to bind SolrDocument to java > beans directly. > This can make the usage of solrj a bit simpler > The QueryResponse class in solrj can have an extra method as follows > public <T> List<T> getResultBeans(Class<T> klass) > and the bean can have annotations as > class MyBean{ > @Field("id") //name is optional > String id; > @Field("category") > List<String> categories > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.