Re: Difference between currency fieldType and float fieldType

2016-12-07 Thread Zheng Lin Edwin Yeo
Thanks for all the replies. Probably will have to go for long or currency fieldType. Int is still 32-bit, and there will be error in indexing if the amount is larger than 2,147,483,647. Since we are storing it as cents, it will hit the limit with just $21.4 million. Regards, Edwin On 7 December

Re: Difference between currency fieldType and float fieldType

2016-12-07 Thread Esther-Melaine Quansah
Cool, that makes sense! Esther Quansah > On Dec 7, 2016, at 9:13 AM, Dorian Hoxha wrote: > > Yeah, you always *100 when you store,query,facet, and you always /100 when > displaying. > > On Wed, Dec 7, 2016 at 3:07 PM, wrote: > >> I think Edwin might be concerned that in storing it as a long t

Re: Difference between currency fieldType and float fieldType

2016-12-07 Thread Dorian Hoxha
Yeah, you always *100 when you store,query,facet, and you always /100 when displaying. On Wed, Dec 7, 2016 at 3:07 PM, wrote: > I think Edwin might be concerned that in storing it as a long type, there > will be no distinguishing between, in example, $1234.56 and $123456. > But correct me if I'm

Re: Difference between currency fieldType and float fieldType

2016-12-07 Thread esther . quansah
I think Edwin might be concerned that in storing it as a long type, there will be no distinguishing between, in example, $1234.56 and $123456. But correct me if I'm wrong - the latter would be stored as 12345600. When sending in a search for all values less than $100,000 on a long field, will

Re: Difference between currency fieldType and float fieldType

2016-12-07 Thread Dorian Hoxha
Come on dude, just use the int/long. Source: double is still a float. On Wed, Dec 7, 2016 at 1:17 PM, Zheng Lin Edwin Yeo wrote: > Thanks for the reply. > > How about using the double fieldType? > I tried that it works, as it is 64-bit, as compared to 32-bit for float. > But will it hit the same

Re: Difference between currency fieldType and float fieldType

2016-12-07 Thread Zheng Lin Edwin Yeo
Thanks for the reply. How about using the double fieldType? I tried that it works, as it is 64-bit, as compared to 32-bit for float. But will it hit the same issue again if the amount exceeds 64-bit? Regards, Edwin On 7 December 2016 at 15:28, Dorian Hoxha wrote: > Yeah, you'll have to do the

Re: Difference between currency fieldType and float fieldType

2016-12-06 Thread Dorian Hoxha
Yeah, you'll have to do the conversion yourself (or something internal, like the currencyField). Think about it as datetimes. You store everything in utc (cents), but display to each user in it's own timezone (different currency, or just from cents to full dollars). On Wed, Dec 7, 2016 at 8:23 AM

Re: Difference between currency fieldType and float fieldType

2016-12-06 Thread Zheng Lin Edwin Yeo
But if I index $1234.56 as "123456", won't it affect the search or facet if I do a query directly to Solr? Say if I search for index with amount that is lesser that $2000, it will not match, unless when we do the search, we have to pass "20" to Solr? Regards, Edwin On 7 December 2016 at 07:

Re: Difference between currency fieldType and float fieldType

2016-12-06 Thread Chris Hostetter
: Thanks for your reply. : : That means the best fieldType to use for money is currencyField, and not : any other fieldType? The primary use case for CurrencyField is when you want to do dynamic currency fluctuations between multiple currency types at query time -- but to do that you either nee

Re: Difference between currency fieldType and float fieldType

2016-12-06 Thread Zheng Lin Edwin Yeo
Thanks for your reply. That means the best fieldType to use for money is currencyField, and not any other fieldType? Regards, Edwin On 6 December 2016 at 21:33, Dorian Hoxha wrote: > Don't use float for money (in whatever db). > https://wiki.apache.org/solr/CurrencyField > What you do is save

Re: Difference between currency fieldType and float fieldType

2016-12-06 Thread Dorian Hoxha
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