That worked. I had to get the schema, get the the FieldType, also get
the Fieldable object from the document, then use
fieldType.toExternal(fieldable).toString() but it ultimately worked!
Thanks for your help, appreciate it.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Yonik
Seeley
Sent: Wednesday, August 08, 2007 6:43 PM
To: solr-user@lucene.apache.org
Subject: Re: Retrieving a float field

On 8/8/07, Seema Khandkar <[EMAIL PROTECTED]> wrote:
> Hi solr-users,
>
> If I have a float field (sfloat) stored and indexed in a solr index, 
> how can I retrieve it within a plugin?=20
>
> Example:
> Document doc =3D solrIndexSearcher.doc(id);=20 String price =3D 
> doc.get("price");=20
>
> The "price" string contains garbage value.

Try FieldType.toExternal() or toObject()

> Ideally I would like to restrict the fields I get back but that does 
> not work either. I get back all fields for that document.
> Document doc =3D solrIndexSearcher.doc(id, fields);  // gives back all

> fields

I haven't tried that myself... I like sticking to the external HTTP APIs
for applications whenever possible.

-Yonik

Reply via email to