lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dorian Hoxha <dorian.ho...@gmail.com>
Subject Re: Difference between currency fieldType and float fieldType
Date Tue, 06 Dec 2016 13:33:53 GMT
Don't use float for money (in whatever db).
https://wiki.apache.org/solr/CurrencyField
What you do is save the money as cents, and store that in a long. That's
what the currencyField probably does for you inside.
It provides currency conversion at query-time.


On Tue, Dec 6, 2016 at 4:45 AM, Zheng Lin Edwin Yeo <edwinyeozl@gmail.com>
wrote:

> Hi,
>
> Would like to understand better between the currency fieldType and float
> fieldType.
>
> If I were to index a field that is a currency field by nature (Eg: amount)
> into Solr, is it better to use the currency fieldType as compared to the
> float fieldType?
>
> I found that for the float fieldType, if the amount is very big, the last
> decimal place may get cut off in the index. For example, if the amount in
> the original document is 800212.64, the number that is indexed in Solr is
> 800212.6.
>
> Although by using the currency fieldType will solve this issue, but however
> I found that I am not able to do faceting on currency fieldType. I will
> need to have the facet so that I can list out the various amount that are
> available based on the search criteria.
>
> As such, will like to seek your recommendation to determine which fieldType
> is best for my needs.
>
> I'm using Solr 6.2.1
>
> Regards,
> Edwin
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message