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 Navaa <na...@xtremumsolutions.com> on 2014/02/21 08:02:39 UTC

Converting solrdocument response into pojo

hi,
I m using solr for searching... here I used for search names on the basis of
their locations
so i get response in docs list containing solrdocument like

response = {docs =[{SolrDocument[name="abcd"
id=[6,6,],......},{SolrDocument[name="xyz" id=435,......},................]}

at the time of getting this type of response into
response.getBeans(Pojo.class)

it throws exception to id field..*id=[6,6]*. my pojo is 
class Pojo{
   @field("name")
   private String name;
  
   @field("id")
   private Integer id;
   .
   .
   .
}

So how can I resolve this exception....please help me ASAP... Thanks in
advance



--
View this message in context: http://lucene.472066.n3.nabble.com/Converting-solrdocument-response-into-pojo-tp4118743.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Converting solrdocument response into pojo

Posted by Alexandre Rafalovitch <ar...@gmail.com>.
On Mon, Feb 24, 2014 at 8:03 PM, Navaa
<na...@xtremumsolutions.com> wrote:
> <copyField source="doctor_id" dest="id"/>

So, you are probably supplying an id and then also merging doctor_id
and id fields together. Which gives you two fields values in ID. I
would have expected Solr to complaint about it, but either way you
have a design issue here.

Regards,
   Alex.

Personal website: http://www.outerthoughts.com/
LinkedIn: http://www.linkedin.com/in/alexandrerafalovitch
- Time is the quality of nature that keeps events from happening all
at once. Lately, it doesn't seem to be working.  (Anonymous  - via GTD
book)

Re: Converting solrdocument response into pojo

Posted by Navaa <na...@xtremumsolutions.com>.
Thank you Alexander for your reply.

Here I am posting my schema definition

<field name="doctor_id"       type="int"    indexed="true"  stored="true" 
multiValued="false" required="false"/>
<field name="id"     type="int" indexed="true"  stored="true" 
multiValued="false" /> 
  <copyField source="doctor_id" dest="id"/>


But I am not able to resolve this issue please tell me where I am going
wrong..... 




--
View this message in context: http://lucene.472066.n3.nabble.com/Converting-solrdocument-response-into-pojo-tp4118743p4119205.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Converting solrdocument response into pojo

Posted by Alexandre Rafalovitch <ar...@gmail.com>.
Looks like at least one of your documents has multiple values in ID
field (all valued as 6...) , but your POJO is expecting one. You may
want to check your schema definition to ensure it does not allow
multiples and also your indexing process to identify why one got
through.

Regards,
   Alex.
Personal website: http://www.outerthoughts.com/
LinkedIn: http://www.linkedin.com/in/alexandrerafalovitch
- Time is the quality of nature that keeps events from happening all
at once. Lately, it doesn't seem to be working.  (Anonymous  - via GTD
book)


On Fri, Feb 21, 2014 at 6:02 PM, Navaa
<na...@xtremumsolutions.com> wrote:
> hi,
> I m using solr for searching... here I used for search names on the basis of
> their locations
> so i get response in docs list containing solrdocument like
>
> response = {docs =[{SolrDocument[name="abcd"
> id=[6,6,],......},{SolrDocument[name="xyz" id=435,......},................]}
>
> at the time of getting this type of response into
> response.getBeans(Pojo.class)
>
> it throws exception to id field..*id=[6,6]*. my pojo is
> class Pojo{
>    @field("name")
>    private String name;
>
>    @field("id")
>    private Integer id;
>    .
>    .
>    .
> }
>
> So how can I resolve this exception....please help me ASAP... Thanks in
> advance
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Converting-solrdocument-response-into-pojo-tp4118743.html
> Sent from the Solr - User mailing list archive at Nabble.com.