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 <edwinye...@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
>

Reply via email to