Thanks for your response Hoss.

Yes we do have Money class already implemented in other areas of our
application which I would like to use.

I will try this out.

-Raghu

-----Original Message-----
From: Chris Hostetter [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 05, 2008 12:20 AM
To: solr-user@lucene.apache.org
Subject: Re: Question about Data Types


:   I have a use case where I need to define my own datatype (Money).
: Will something like this work? Are there any issues with this
approach?

: <fieldType name="money" class="xyz.Money" omitNorms="true" />

Assuming you have implemented a Java class named "Money" in the package 
"xyz" and you are subclassing the FieldType class -- then yes.  you can 
implment any sort of FieldType you want.  YOu can even subclass
something 
like the SortableFloatType to reuse a lot of the existing code if it's 
useful to you.

But i'm not sure if that's what you are asking.

You could also do something like this...

  <fieldType name="money" class="solr.SortableFloat" />

now you've got a fieldType called "money" that you can refer to in other

fields in your schema, and you don't have to writ any java code -- 
assuming all you really care about is storing a floating point value.

It really depends on what it is you mean by saying you want your own 
datatype.


-Hoss

Reply via email to